Changeset 17369
- Timestamp:
- 11/25/19 12:04:30 (5 years ago)
- Location:
- branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs
r17180 r17369 42 42 private const string SpecialFunctionsName = "Special Functions"; 43 43 private const string TimeSeriesSymbolsName = "Time Series Symbols"; 44 private const string BasicVectorOperationSymbolsName = "Basic Vector Operations"; 45 private const string VectorAggregationSymbolsName = "Vector Aggregation"; 46 private const string VectorSymbolsName = "Vector Symbols"; 44 47 45 48 [StorableConstructor] … … 113 116 var laggedVariable = new LaggedVariable(); 114 117 var autoregressiveVariable = new AutoregressiveTargetVariable(); 118 119 var vectorVariable = new VectorVariable(); 120 var vectorAdd = new VectorAddition(); 121 var vectorSub = new VectorSubtraction(); 122 var vectorMul = new VectorMultiplication(); 123 var vectorDiv = new VectorDivision(); 124 var vectorSum = new VectorSum(); 125 var vectorAvg = new VectorAverage(); 115 126 #endregion 116 127 117 128 #region group symbol declaration 118 129 var arithmeticSymbols = new GroupSymbol(ArithmeticFunctionsName, new List<ISymbol>() { add, sub, mul, div, mean }); 119 var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan, tanh });120 var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log });130 var trigonometricSymbols = new GroupSymbol(TrigonometricFunctionsName, new List<ISymbol>() { sin, cos, tan, tanh }); 131 var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log }); 121 132 var specialFunctions = new GroupSymbol(SpecialFunctionsName, new List<ISymbol> { abs, airyA, airyB, bessel, cosineIntegral, dawson, erf, expIntegralEi, 122 133 fresnelCosineIntegral,fresnelSineIntegral,gamma,hypCosineIntegral,hypSineIntegral,norm, psi, sineIntegral, analyticalQuotient}); … … 132 143 133 144 var timeSeriesSymbols = new GroupSymbol(TimeSeriesSymbolsName, new List<ISymbol> { timeLag, integral, derivative, laggedVariable, autoregressiveVariable }); 145 146 var basicVectorOperationSymbols = new GroupSymbol(BasicVectorOperationSymbolsName, new List<ISymbol>() { vectorAdd, vectorSub, vectorMul, vectorDiv }); 147 var vectorAggregationSymbols = new GroupSymbol(VectorAggregationSymbolsName, new List<ISymbol>() { vectorSum, vectorAvg }); 148 var vectorSymbols = new GroupSymbol(VectorSymbolsName, new List<ISymbol>() { vectorVariable, basicVectorOperationSymbols, vectorAggregationSymbols }); 134 149 #endregion 135 150 … … 138 153 AddSymbol(conditionalSymbols); 139 154 AddSymbol(timeSeriesSymbols); 155 AddSymbol(vectorSymbols); 140 156 141 157 #region subtree count configuration … … 149 165 SetSubtreeCount(cubeRoot, 1, 1); 150 166 SetSubtreeCount(exponentialAndLogarithmicSymbols, 1, 1); 151 foreach (var sy in specialFunctions.Symbols.Except(new[] { analyticalQuotient})) {167 foreach (var sy in specialFunctions.Symbols.Except(new[] { analyticalQuotient })) { 152 168 SetSubtreeCount(sy, 1, 1); 153 169 } … … 169 185 SetSubtreeCount(laggedVariable, 0, 0); 170 186 SetSubtreeCount(autoregressiveVariable, 0, 0); 187 188 189 SetSubtreeCount(vectorVariable, 0, 0); 190 SetSubtreeCount(basicVectorOperationSymbols, 2, 2); 191 SetSubtreeCount(vectorAggregationSymbols, 1, 1); 171 192 #endregion 172 193 … … 237 258 AddAllowedChildSymbol(derivative, powerSymbols); 238 259 AddAllowedChildSymbol(derivative, conditionSymbols); 260 261 AddAllowedChildSymbol(realValuedSymbols, vectorAggregationSymbols); 262 AddAllowedChildSymbol(vectorAggregationSymbols, basicVectorOperationSymbols); 263 AddAllowedChildSymbol(vectorAggregationSymbols, vectorVariable); 264 AddAllowedChildSymbol(basicVectorOperationSymbols, basicVectorOperationSymbols); 265 AddAllowedChildSymbol(basicVectorOperationSymbols, vectorVariable); 239 266 #endregion 240 267 } … … 249 276 Symbols.First(s => s.Name == ConditionalSymbolsName).Enabled = false; 250 277 Symbols.First(s => s.Name == TimeSeriesSymbolsName).Enabled = false; 278 Symbols.First(s => s.Name == VectorSymbolsName).Enabled = false; 251 279 } 252 280 … … 262 290 Symbols.First(s => s.Name == PowerFunctionsName).Enabled = false; 263 291 Symbols.First(s => s.Name == TimeSeriesSymbolsName).Enabled = false; 292 Symbols.First(s => s.Name == VectorSymbolsName).Enabled = false; 264 293 } 265 294 … … 272 301 Symbols.First(s => s.Name == ConditionalSymbolsName).Enabled = false; 273 302 Symbols.First(s => s.Name == SpecialFunctionsName).Enabled = false; 303 Symbols.First(s => s.Name == VectorSymbolsName).Enabled = false; 274 304 275 305 Symbols.Single(s => s.Name == "Variable").Enabled = false; -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r17344 r17369 219 219 <Compile Include="SymbolicDataAnalysisProblem.cs" /> 220 220 <Compile Include="SymbolicDataAnalysisSolutionImpactValuesCalculator.cs" /> 221 <Compile Include="Symbols\VectorAverage.cs" /> 222 <Compile Include="Symbols\VectorSum.cs" /> 223 <Compile Include="Symbols\VectorSubtraction.cs" /> 224 <Compile Include="Symbols\VectorMultiplication.cs" /> 225 <Compile Include="Symbols\VectorDivision.cs" /> 226 <Compile Include="Symbols\VectorAddition.cs" /> 221 227 <Compile Include="Symbols\Addition.cs" /> 222 228 <Compile Include="Symbols\AnalyticQuotient.cs" /> … … 237 243 <Compile Include="Symbols\CubeRoot.cs" /> 238 244 <Compile Include="Symbols\HyperbolicTangent.cs" /> 245 <Compile Include="Symbols\VectorVariableTreeNode.cs" /> 246 <Compile Include="Symbols\VectorVariable.cs" /> 239 247 <Compile Include="Symbols\VariableBase.cs" /> 240 248 <Compile Include="Symbols\VariableTreeNodeBase.cs" /> -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r17367 r17369 552 552 DoubleVector s = VectorEvaluate(dataset, ref row, state); 553 553 for (int i = 1; i < currentInstr.nArguments; i++) { 554 s += Evaluate(dataset, ref row, state);554 s += VectorEvaluate(dataset, ref row, state); 555 555 } 556 556 return s; … … 559 559 DoubleVector s = VectorEvaluate(dataset, ref row, state); 560 560 for (int i = 1; i < currentInstr.nArguments; i++) { 561 s -= Evaluate(dataset, ref row, state);561 s -= VectorEvaluate(dataset, ref row, state); 562 562 } 563 563 return s; … … 566 566 DoubleVector s = VectorEvaluate(dataset, ref row, state); 567 567 for (int i = 1; i < currentInstr.nArguments; i++) { 568 s *= Evaluate(dataset, ref row, state);568 s *= VectorEvaluate(dataset, ref row, state); 569 569 } 570 570 return s; … … 573 573 DoubleVector s = VectorEvaluate(dataset, ref row, state); 574 574 for (int i = 1; i < currentInstr.nArguments; i++) { 575 s /= Evaluate(dataset, ref row, state);575 s /= VectorEvaluate(dataset, ref row, state); 576 576 } 577 577 return s; -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r17180 r17369 239 239 } 240 240 } 241 foreach (var vectorVariableSymbol in grammar.Symbols.OfType<VectorVariable>()) { 242 if (!vectorVariableSymbol.Fixed) { 243 vectorVariableSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<DoubleVector>(x)); 244 vectorVariableSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<DoubleVector>(x)); 245 } 246 } 241 247 } 242 248 -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VectorVariable.cs
r17367 r17369 32 32 private VectorVariable(StorableConstructorFlag _) : base(_) { 33 33 } 34 private VectorVariable(V ariable original, Cloner cloner)34 private VectorVariable(VectorVariable original, Cloner cloner) 35 35 : base(original, cloner) { 36 36 }
Note: See TracChangeset
for help on using the changeset viewer.