- Timestamp:
- 03/07/19 13:30:07 (6 years ago)
- Location:
- trunk/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 12 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/branches/2866_SymRegHyperbolicFunctions/HeuristicLab.Problems.DataAnalysis.Symbolic (added) merged: 16375,16531,16654-16655
- Property svn:mergeinfo changed
-
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/TreeToAutoDiffTermConverter.cs
r16565 r16656 76 76 eval: Math.Tan, 77 77 diff: x => 1 + Math.Tan(x) * Math.Tan(x)); 78 78 private static readonly Func<Term, UnaryFunc> tanh = UnaryFunc.Factory( 79 eval: Math.Tanh, 80 diff: x => 1 - Math.Tanh(x) * Math.Tanh(x)); 79 81 private static readonly Func<Term, UnaryFunc> erf = UnaryFunc.Factory( 80 82 eval: alglib.errorfunction, … … 261 263 if (node.Symbol is Tangent) { 262 264 return tan( 265 ConvertToAutoDiff(node.GetSubtree(0))); 266 } 267 if (node.Symbol is HyperbolicTangent) { 268 return tanh( 263 269 ConvertToAutoDiff(node.GetSubtree(0))); 264 270 } … … 321 327 !(n.Symbol is Cosine) && 322 328 !(n.Symbol is Tangent) && 329 !(n.Symbol is HyperbolicTangent) && 323 330 !(n.Symbol is Erf) && 324 331 !(n.Symbol is Norm) && -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs
r16565 r16656 55 55 var log = new Logarithm(); 56 56 var abs = new Absolute(); 57 var tanh = new HyperbolicTangent(); 57 58 var pow = new Power(); 58 59 pow.InitialFrequency = 0.0; … … 129 130 autoregressiveVariable.Enabled = false; 130 131 131 var allSymbols = new List<Symbol>() { add, sub, mul, div, aq, mean, abs, sin, cos, tan, log, square, cube, pow, sqrt, cubeRoot, root, exp, 132 var allSymbols = new List<Symbol>() { add, sub, mul, div, aq, mean, abs, sin, cos, tan, log, square, cube, pow, sqrt, cubeRoot, root, exp, tanh, 132 133 airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral, 133 134 @if, gt, lt, and, or, not,xor, timeLag, integral, derivative, constant, variableSymbol, binFactorVariable, factorVariable, laggedVariable,autoregressiveVariable, variableCondition }; 134 var unaryFunctionSymbols = new List<Symbol>() { abs, square, sqrt, cube, cubeRoot, sin, cos, tan, log, exp, not, timeLag, integral, derivative,135 var unaryFunctionSymbols = new List<Symbol>() { abs, square, sqrt, cube, cubeRoot, sin, cos, tan, log, exp, tanh, not, timeLag, integral, derivative, 135 136 airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, fresnelCosineIntegral, fresnelSineIntegral, gamma, hypCosineIntegral, hypSineIntegral, norm, psi, sineIntegral 136 137 }; -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
r16565 r16656 85 85 var gamma = new Gamma(); 86 86 var hypCosineIntegral = new HyperbolicCosineIntegral(); 87 var tanh = new HyperbolicTangent(); 87 88 var hypSineIntegral = new HyperbolicSineIntegral(); 88 89 var norm = new Norm(); … … 116 117 #region group symbol declaration 117 118 var arithmeticSymbols = new GroupSymbol(ArithmeticFunctionsName, new List<ISymbol>() { add, sub, mul, div, mean }); 118 var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan 119 var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log 119 var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan, tanh}); 120 var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log}); 120 121 var specialFunctions = new GroupSymbol(SpecialFunctionsName, new List<ISymbol> { abs, airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, 121 122 fresnelCosineIntegral,fresnelSineIntegral,gamma,hypCosineIntegral,hypSineIntegral,norm, psi, sineIntegral, analyticalQuotient}); … … 242 243 Symbols.First(s => s is Average).Enabled = false; 243 244 Symbols.First(s => s is Absolute).Enabled = false; 245 Symbols.First(s => s is HyperbolicTangent).Enabled = false; 244 246 Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false; 245 247 Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false; … … 254 256 Symbols.First(s => s is Xor).Enabled = false; 255 257 Symbols.First(s => s is Absolute).Enabled = false; 258 Symbols.First(s => s is HyperbolicTangent).Enabled = false; 256 259 Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false; 257 260 Symbols.First(s => s.Name == ExponentialFunctionsName).Enabled = false; … … 264 267 Symbols.First(s => s is Average).Enabled = false; 265 268 Symbols.First(s => s is Absolute).Enabled = false; 269 Symbols.First(s => s is HyperbolicTangent).Enabled = false; 266 270 Symbols.First(s => s.Name == TrigonometricFunctionsName).Enabled = false; 267 271 Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false; -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r16625 r16656 231 231 <Compile Include="Symbols\Absolute.cs" /> 232 232 <Compile Include="Symbols\CubeRoot.cs" /> 233 <Compile Include="Symbols\HyperbolicTangent.cs" /> 233 234 <Compile Include="Symbols\VariableBase.cs" /> 234 235 <Compile Include="Symbols\VariableTreeNodeBase.cs" /> -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/InfixExpressionParser.cs
r16565 r16656 111 111 { "COS", new Cosine()}, 112 112 { "TAN", new Tangent()}, 113 { "TANH", new HyperbolicTangent()}, 113 114 { "AIRYA", new AiryA()}, 114 115 { "AIRYB", new AiryB()}, -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Importer/SymbolicExpressionImporter.cs
r16565 r16656 53 53 {"COS", new Cosine()}, 54 54 {"TAN", new Tangent()}, 55 {"TANH", new HyperbolicTangent ()}, 55 56 {"AIRYA", new AiryA()}, 56 57 {"AIRYB", new AiryB()}, -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/BatchOperations.cs
r16356 r16656 69 69 a[i] = Math.Tan(b[i]); 70 70 } 71 public static void Tanh(double[] a, double[] b) { 72 for (int i = 0; i < BATCHSIZE; ++i) 73 a[i] = Math.Tanh(b[i]); 74 } 71 75 72 76 public static void Pow(double[] a, double[] b) { -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs
r16565 r16656 90 90 public const byte CubeRoot = 51; 91 91 92 public const byte Tanh = 52; 93 92 94 93 95 private static Dictionary<Type, byte> symbolToOpcode = new Dictionary<Type, byte>() { … … 99 101 { typeof(Cosine), OpCodes.Cos }, 100 102 { typeof(Tangent), OpCodes.Tan }, 103 { typeof (HyperbolicTangent), OpCodes.Tanh}, 101 104 { typeof(Logarithm), OpCodes.Log }, 102 105 { typeof(Exponential), OpCodes.Exp }, -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeBatchInterpreter.cs
r16565 r16656 159 159 break; 160 160 } 161 161 case OpCodes.Tanh: { 162 Tanh(instr.buf, code[c].buf); 163 break; 164 } 162 165 case OpCodes.Absolute: { 163 166 Absolute(instr.buf, code[c].buf); -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r16565 r16656 205 205 return Math.Abs(Evaluate(dataset, ref row, state)); 206 206 } 207 case OpCodes.Tanh: { 208 return Math.Tanh(Evaluate(dataset, ref row, state)); 209 } 207 210 case OpCodes.Cos: { 208 211 return Math.Cos(Evaluate(dataset, ref row, state)); -
trunk/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
r16565 r16656 226 226 } else if (instr.opCode == OpCodes.Absolute) { 227 227 instr.value = Math.Abs(code[instr.childIndex].value); 228 } else if (instr.opCode == OpCodes.Tanh) { 229 instr.value = Math.Tanh(code[instr.childIndex].value); 228 230 } else if (instr.opCode == OpCodes.Cos) { 229 231 instr.value = Math.Cos(code[instr.childIndex].value);
Note: See TracChangeset
for help on using the changeset viewer.