Changeset 17830 for branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars
- Timestamp:
- 02/01/21 18:33:07 (4 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentVectorTimeSeriesExpressionGrammar.cs
r17824 r17830 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 31 [StorableType(" 7EC7B4A7-0E27-4011-B983-B0E15A6944EC")]32 [Item("TypeCoherentVector ExpressionGrammar", "Represents a grammar for functional expressions in which special syntactic constraints are enforced so that vector and scalar expressions are not mixed.")]33 public class TypeCoherentVector ExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar {31 [StorableType("88895D71-3D3F-44A7-A531-D5D59963AABE")] 32 [Item("TypeCoherentVectorTimeSeriesExpressionGrammar", "Represents a grammar for functional expressions in which special syntactic constraints are enforced so that vector and scalar expressions are not mixed.")] 33 public class TypeCoherentVectorTimeSeriesExpressionGrammar : DataAnalysisGrammar, ISymbolicDataAnalysisGrammar { 34 34 private const string ArithmeticFunctionsName = "Arithmetic Functions"; 35 35 private const string TrigonometricFunctionsName = "Trigonometric Functions"; … … 40 40 private const string VectorStatisticsName = "Vector Statistics"; 41 41 private const string VectorDistancesName = "Vector Distances"; 42 private const string VectorDistributionCharacteristicsName = "Distribution Characteristics"; 43 private const string VectorTimeSeriesDynamicsName = "Time Series Dynamics"; 42 44 private const string ScalarSymbolsName = "Scalar Symbols"; 43 45 … … 54 56 55 57 [StorableConstructor] 56 protected TypeCoherentVector ExpressionGrammar(StorableConstructorFlag _) : base(_) { }57 protected TypeCoherentVector ExpressionGrammar(TypeCoherentVectorExpressionGrammar original, Cloner cloner) : base(original, cloner) { }58 public TypeCoherentVector ExpressionGrammar()59 : base(ItemAttribute.GetName(typeof(TypeCoherentVector ExpressionGrammar)), ItemAttribute.GetDescription(typeof(TypeCoherentVectorExpressionGrammar))) {58 protected TypeCoherentVectorTimeSeriesExpressionGrammar(StorableConstructorFlag _) : base(_) { } 59 protected TypeCoherentVectorTimeSeriesExpressionGrammar(TypeCoherentVectorTimeSeriesExpressionGrammar original, Cloner cloner) : base(original, cloner) { } 60 public TypeCoherentVectorTimeSeriesExpressionGrammar() 61 : base(ItemAttribute.GetName(typeof(TypeCoherentVectorTimeSeriesExpressionGrammar)), ItemAttribute.GetDescription(typeof(TypeCoherentVectorTimeSeriesExpressionGrammar))) { 60 62 Initialize(); 61 63 } 62 64 public override IDeepCloneable Clone(Cloner cloner) { 63 return new TypeCoherentVector ExpressionGrammar(this, cloner);65 return new TypeCoherentVectorTimeSeriesExpressionGrammar(this, cloner); 64 66 } 65 67 … … 86 88 87 89 var constant = new Constant { MinValue = -20, MaxValue = 20 }; 90 var constantZeroToOne = new Constant { Name = "Constant [0-1]", MinValue = 0, MaxValue = 1 }; 88 91 var variable = new Variable(); 89 92 var binFactorVariable = new BinaryFactorVariable(); … … 91 94 92 95 var mean = new Mean(); 96 var median = new Median() { Enabled = false }; 93 97 var sd = new StandardDeviation(); 94 98 var sum = new Sum(); … … 96 100 var min = new Min() { Enabled = false }; 97 101 var max = new Max() { Enabled = false }; 102 var quantile = new Quantile() { Enabled = false }; 98 103 var variance = new Variance() { Enabled = false }; 99 104 var skewness = new Skewness() { Enabled = false }; … … 124 129 125 130 var vectorvariable = new Variable() { Name = "Vector Variable" }; 131 132 #region TimeSeries Symbols 133 var absoluteEnergy = new AbsoluteEnergy() { Enabled = false }; 134 var binnedEntropy = new BinnedEntropy() { Enabled = false }; 135 var hasLargeStandardDeviation = new HasLargeStandardDeviation() { Enabled = false }; 136 var hasVarianceLargerThanStd = new HasVarianceLargerThanStd() { Enabled = false }; 137 var isSymmetricLooking = new IsSymmetricLooking() { Enabled = false }; 138 var numberDataPointsAboveMean = new NumberDataPointsAboveMean() { Enabled = false }; 139 var numberDataPointsAboveMedian = new NumberDataPointsAboveMedian() { Enabled = false }; 140 var numberDataPointsBelowMean = new NumberDataPointsBelowMean() { Enabled = false }; 141 var numberDataPointsBelowMedian = new NumberDataPointsBelowMedian() { Enabled = false }; 142 143 var arimaModelCoefficients = new ArimaModelCoefficients() { Enabled = false }; 144 var continuousWaveletTransformationCoefficients = new ContinuousWaveletTransformationCoefficients() { Enabled = false }; 145 var fastFourierTransformationCoefficient = new FastFourierTransformationCoefficient() { Enabled = false }; 146 var firstIndexMax = new FirstIndexMax() { Enabled = false }; 147 var firstIndexMin = new FirstIndexMin() { Enabled = false }; 148 var lastIndexMax = new LastIndexMax() { Enabled = false }; 149 var lastIndexMin = new LastIndexMin() { Enabled = false }; 150 var longestStrikeAboveMean = new LongestStrikeAboveMean() { Enabled = false }; 151 var longestStrikeAboveMedian = new LongestStrikeAboveMedian() { Enabled = false }; 152 var longestStrikeBelowMean = new LongestStrikeBelowMean() { Enabled = false }; 153 var longestStrikeBelowMedian = new LongestStrikeBelowMedian() { Enabled = false }; 154 var longestStrikePositive = new LongestStrikePositive() { Enabled = false }; 155 var longestStrikeNegative = new LongestStrikeNegative() { Enabled = false }; 156 var longestStrikeZero = new LongestStrikeZero() { Enabled = false }; 157 var meanAbsoluteChange = new MeanAbsoluteChange() { Enabled = false }; 158 var meanAbsoluteChangeQuantiles = new MeanAbsoluteChangeQuantiles() { Enabled = false }; 159 var meanAutocorrelation = new MeanAutocorrelation() { Enabled = false }; 160 var laggedAutocorrelation = new LaggedAutocorrelation() { Enabled = false }; 161 var meanSecondDerivateCentral = new MeanSecondDerivateCentral() { Enabled = false }; 162 var numberPeaksOfSize = new NumberPeaksOfSize() { Enabled = false }; 163 var largeNumberOfPeaks = new LargeNumberOfPeaks() { Enabled = false }; 164 var timeReversalAsymmetryStatistic = new TimeReversalAsymmetryStatistic() { Enabled = false }; 165 #endregion 126 166 #endregion 127 167 … … 135 175 var exponentialAndLogarithmicSymbols = new GroupSymbol(ExponentialFunctionsName, new List<ISymbol> { exp, log }); 136 176 var powerSymbols = new GroupSymbol(PowerFunctionsName, new List<ISymbol> { square, sqrt, cube, cubeRoot, power, root }); 137 var terminalSymbols = new GroupSymbol(TerminalsName, new List<ISymbol> { constant, variable, binFactorVariable, factorVariable });138 var statisticsSymbols = new GroupSymbol(VectorStatisticsName, new List<ISymbol> { mean, sd, sum, length, min, max, variance, skewness, kurtosis });177 var terminalSymbols = new GroupSymbol(TerminalsName, new List<ISymbol> { constant, constantZeroToOne, variable, binFactorVariable, factorVariable }); 178 var statisticsSymbols = new GroupSymbol(VectorStatisticsName, new List<ISymbol> { mean, median, sd, sum, length, min, max, quantile, variance, skewness, kurtosis }); 139 179 var distancesSymbols = new GroupSymbol(VectorDistancesName, new List<ISymbol> { euclideanDistance, covariance }); 140 var aggregationSymbols = new GroupSymbol(VectorAggregationName, new List<ISymbol> { statisticsSymbols, distancesSymbols }); 180 var distributionCharacteristicsSymbols = new GroupSymbol(VectorDistributionCharacteristicsName, new List<ISymbol> { 181 absoluteEnergy, binnedEntropy, hasLargeStandardDeviation, hasVarianceLargerThanStd, isSymmetricLooking, 182 numberDataPointsAboveMean, numberDataPointsAboveMedian, numberDataPointsBelowMean, numberDataPointsBelowMedian 183 }); 184 var timeSeriesDynamicsSymbols = new GroupSymbol(VectorTimeSeriesDynamicsName, new List<ISymbol> { 185 arimaModelCoefficients, continuousWaveletTransformationCoefficients, fastFourierTransformationCoefficient, 186 firstIndexMax, firstIndexMin, lastIndexMax, lastIndexMin, 187 longestStrikeAboveMean, longestStrikeAboveMedian, longestStrikeBelowMean, longestStrikeBelowMedian, longestStrikePositive, longestStrikePositive, longestStrikeNegative, longestStrikeZero, 188 meanAbsoluteChange, meanAbsoluteChangeQuantiles, meanAutocorrelation, laggedAutocorrelation, meanSecondDerivateCentral, meanSecondDerivateCentral, 189 numberPeaksOfSize, largeNumberOfPeaks, timeReversalAsymmetryStatistic 190 }); 191 var aggregationSymbols = new GroupSymbol(VectorAggregationName, new List<ISymbol> { statisticsSymbols, distancesSymbols, distributionCharacteristicsSymbols, timeSeriesDynamicsSymbols }); 141 192 var scalarSymbols = new GroupSymbol(ScalarSymbolsName, new List<ISymbol>() { arithmeticSymbols, trigonometricSymbols, exponentialAndLogarithmicSymbols, powerSymbols, terminalSymbols, aggregationSymbols }); 142 193 … … 170 221 SetSubtreeCount(exponentialAndLogarithmicSymbols, 1, 1); 171 222 SetSubtreeCount(terminalSymbols, 0, 0); 172 SetSubtreeCount(statisticsSymbols, 1, 1); 223 foreach (var sy in new Symbol[] { mean, median, sd, sum, length, min, max, variance, skewness, kurtosis }) 224 SetSubtreeCount(sy, 1, 1); 225 SetSubtreeCount(quantile, 2, 2); 173 226 SetSubtreeCount(distancesSymbols, 2, 2); 227 #region TimeSeries symbols 228 foreach (var sy in new Symbol[] { 229 absoluteEnergy, hasLargeStandardDeviation, hasVarianceLargerThanStd, isSymmetricLooking, 230 numberDataPointsAboveMean, numberDataPointsAboveMedian, numberDataPointsBelowMean, numberDataPointsBelowMedian 231 }) SetSubtreeCount(sy, 1, 1); 232 foreach (var sy in new Symbol[] { binnedEntropy }) 233 SetSubtreeCount(sy, 2, 2); 234 235 foreach (var sy in new Symbol[] { 236 firstIndexMax, firstIndexMin, lastIndexMax, lastIndexMin, 237 longestStrikeAboveMean, longestStrikeAboveMedian, longestStrikeBelowMean, longestStrikeBelowMedian, 238 longestStrikePositive, longestStrikeNegative, longestStrikeZero, 239 meanAbsoluteChange, meanAutocorrelation, meanSecondDerivateCentral 240 }) SetSubtreeCount(sy, 1, 1); 241 foreach (var sy in new Symbol[] { 242 fastFourierTransformationCoefficient, laggedAutocorrelation, numberPeaksOfSize, timeReversalAsymmetryStatistic 243 }) SetSubtreeCount(sy, 2, 2); 244 foreach (var sy in new Symbol[] { 245 arimaModelCoefficients, continuousWaveletTransformationCoefficients, 246 meanAbsoluteChangeQuantiles, largeNumberOfPeaks 247 }) SetSubtreeCount(sy, 3, 3); 248 #endregion 174 249 175 250 SetSubtreeCount(vectorarithmeticSymbols, 2, 2); … … 197 272 AddAllowedChildSymbol(power, constant, 1); 198 273 AddAllowedChildSymbol(root, constant, 1); 199 AddAllowedChildSymbol(aggregationSymbols, vectorSymbols); 200 AddAllowedChildSymbol(statisticsSymbols, subvector); 274 AddAllowedChildSymbol(aggregationSymbols, vectorSymbols, 0); 275 AddAllowedChildSymbol(statisticsSymbols, subvector, 0); 276 AddAllowedChildSymbol(quantile, constantZeroToOne, 1); 277 AddAllowedChildSymbol(distancesSymbols, vectorSymbols, 1); 278 AddAllowedChildSymbol(distributionCharacteristicsSymbols, vectorSymbols, 0); 279 AddAllowedChildSymbol(distributionCharacteristicsSymbols, subvector, 0); 280 AddAllowedChildSymbol(distributionCharacteristicsSymbols, constantZeroToOne, 1); 281 AddAllowedChildSymbol(timeSeriesDynamicsSymbols, vectorSymbols, 0); 282 AddAllowedChildSymbol(timeSeriesDynamicsSymbols, subvector, 0); 283 AddAllowedChildSymbol(timeSeriesDynamicsSymbols, constantZeroToOne, 1); 284 AddAllowedChildSymbol(timeSeriesDynamicsSymbols, constantZeroToOne, 2); 201 285 202 286 AddAllowedChildSymbol(vectorarithmeticSymbols, vectorSymbols); … … 205 289 AddAllowedChildSymbol(vectorexponentialAndLogarithmicSymbols, vectorSymbols); 206 290 AddAllowedChildSymbol(vectorpowerSymbols, vectorSymbols, 0); 207 AddAllowedChildSymbol(vectorpower, constant , 1);208 AddAllowedChildSymbol(vectorroot, constant , 1);291 AddAllowedChildSymbol(vectorpower, constantZeroToOne, 1); 292 AddAllowedChildSymbol(vectorroot, constantZeroToOne, 1); 209 293 210 294 AddAllowedChildSymbol(subvector, vectorSymbols);
Note: See TracChangeset
for help on using the changeset viewer.