Changeset 14939
- Timestamp:
- 05/05/17 20:05:24 (8 years ago)
- Location:
- stable
- Files:
-
- 10 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 14422-14423
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis merged: 14422
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis merged: 14423
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SymbolicTimeSeriesPrognosisExpressionTreeInterpreter.cs
r14811 r14939 45 45 } 46 46 47 [ThreadStatic]48 private static double[] targetVariableCache;49 [ThreadStatic]50 private static List<int> invalidateCacheIndexes;51 52 47 [StorableConstructor] 53 48 private SymbolicTimeSeriesPrognosisExpressionTreeInterpreter(bool deserializing) : base(deserializing) { } … … 77 72 if (CheckExpressionsWithIntervalArithmetic) 78 73 throw new NotSupportedException("Interval arithmetic is not yet supported in the symbolic data analysis interpreter."); 79 if (targetVariableCache == null || targetVariableCache.GetLength(0) < dataset.Rows)80 targetVariableCache = dataset.GetDoubleValues(TargetVariable).ToArray();81 if (invalidateCacheIndexes == null)82 invalidateCacheIndexes = new List<int>(10);83 74 84 75 string targetVariable = TargetVariable; 76 double[] targetVariableCache = dataset.GetDoubleValues(targetVariable).ToArray(); 85 77 lock (syncRoot) { 86 78 EvaluatedSolutions++; // increment the evaluated solutions counter … … 100 92 vProgs[i] = Evaluate(dataset, ref localRow, state); 101 93 targetVariableCache[localRow] = vProgs[i]; 102 invalidateCacheIndexes.Add(localRow);103 94 state.Reset(); 104 95 } 105 96 yield return vProgs; 106 107 int j = 0;108 foreach (var targetValue in dataset.GetDoubleValues(targetVariable, invalidateCacheIndexes)) {109 targetVariableCache[invalidateCacheIndexes[j]] = targetValue;110 j++;111 }112 invalidateCacheIndexes.Clear();113 97 } 114 98 -
stable/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Views merged: 14422
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r14874 r14939 410 410 <Compile Include="Solution Views\TimeSeriesPrognosisSolutionView.Designer.cs"> 411 411 <DependentUpon>TimeSeriesPrognosisSolutionView.cs</DependentUpon> 412 </Compile> 413 <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisLineChartView.cs"> 414 <SubType>UserControl</SubType> 415 </Compile> 416 <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisLineChartView.Designer.cs"> 417 <DependentUpon>TimeSeriesPrognosisLineChartView.cs</DependentUpon> 412 418 </Compile> 413 419 <Compile Include="TimeSeriesPrognosis\TimeSeriesPrognosisResultsView.cs"> -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs
r14309 r14939 57 57 } 58 58 59 protected virtual void GetTrainingSeries(out int[] x, out double[] y) { 60 x = Content.ProblemData.TrainingIndices.ToArray(); 61 y = Content.EstimatedTrainingValues.ToArray(); 62 } 63 64 protected virtual void GetTestSeries(out int[] x, out double[] y) { 65 x = Content.ProblemData.TestIndices.ToArray(); 66 y = Content.EstimatedTestValues.ToArray(); 67 } 68 69 protected virtual void GetAllValuesSeries(out int[] x, out double[] y) { 70 x = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray(); 71 var tmp = Content.EstimatedValues.ToArray(); 72 y = x.Select(index => tmp[index]).ToArray(); 73 } 74 59 75 private void RedrawChart() { 60 76 this.chart.Series.Clear(); … … 73 89 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine; 74 90 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.Color = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Color; 75 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndices.ToArray(), Content.EstimatedTrainingValues.ToArray()); 91 int[] trainingIdx; 92 double[] trainingY; 93 GetTrainingSeries(out trainingIdx, out trainingY); 94 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(trainingIdx, trainingY); 76 95 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME]); 77 96 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Tag = Content; 97 78 98 // test series 79 99 this.chart.Series.Add(ESTIMATEDVALUES_TEST_SERIES_NAME); 80 100 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME; 81 101 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine; 82 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndices.ToArray(), Content.EstimatedTestValues.ToArray()); 102 int[] testIdx; 103 double[] testY; 104 GetTestSeries(out testIdx, out testY); 105 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(testIdx, testY); 83 106 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME]); 84 107 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content; 108 85 109 // series of remaining points 86 int[] allIndices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray(); 87 var estimatedValues = Content.EstimatedValues.ToArray(); 88 List<double> allEstimatedValues = allIndices.Select(index => estimatedValues[index]).ToList(); 110 int[] allIdx; 111 double[] allEstimatedValues; 112 GetAllValuesSeries(out allIdx, out allEstimatedValues); 113 89 114 this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME); 90 115 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME; 91 116 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine; 92 if (allEstimatedValues. Count> 0) {93 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allI ndices, allEstimatedValues);117 if (allEstimatedValues.Length > 0) { 118 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIdx, allEstimatedValues); 94 119 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 95 120 } … … 244 269 } 245 270 } else if (Content != null) { 246 string targetVariableName = Content.ProblemData.TargetVariable; 247 248 IEnumerable<int> indices = null; 271 272 int[] indices = null; 249 273 double[] predictedValues = null; 250 274 switch (series.Name) { 251 275 case ESTIMATEDVALUES_ALL_SERIES_NAME: 252 indices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray(); 253 var estimatedValues = Content.EstimatedValues.ToArray(); 254 predictedValues = indices.Select(index => estimatedValues[index]).ToArray(); 276 GetAllValuesSeries(out indices, out predictedValues); 255 277 break; 256 278 case ESTIMATEDVALUES_TRAINING_SERIES_NAME: 257 indices = Content.ProblemData.TrainingIndices.ToArray(); 258 predictedValues = Content.EstimatedTrainingValues.ToArray(); 279 GetTrainingSeries(out indices, out predictedValues); 259 280 break; 260 281 case ESTIMATEDVALUES_TEST_SERIES_NAME: 261 indices = Content.ProblemData.TestIndices.ToArray(); 262 predictedValues = Content.EstimatedTestValues.ToArray(); 282 GetTestSeries(out indices, out predictedValues); 263 283 break; 264 284 } -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisSolution.cs
r14186 r14939 21 21 22 22 using System.Collections.Generic; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 43 44 return Model.GetPrognosedValues(ProblemData.Dataset, rows, horizons); 44 45 } 46 47 public override IEnumerable<double> PrognosedTestValues { 48 get { 49 return Model.GetPrognosedValues(ProblemData.Dataset, ProblemData.TestIndices.Take(1), 50 new int[] { ProblemData.TestIndices.Count() }).First(); 51 } 52 } 45 53 } 46 54 } -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionBase.cs
r14186 r14939 64 64 } 65 65 66 public abstract IEnumerable<double> PrognosedTestValues { get; } 66 67 public abstract IEnumerable<IEnumerable<double>> GetPrognosedValues(IEnumerable<int> rows, IEnumerable<int> horizon); 67 68 … … 150 151 OnlineCalculatorError errorState; 151 152 double trainingMean = ProblemData.TrainingIndices.Any() ? ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).Average() : double.NaN; 152 var meanModel = new ConstantModel(trainingMean, ProblemData.TargetVariable);153 var meanModel = new ConstantModel(trainingMean, ProblemData.TargetVariable); 153 154 154 155 double alpha, beta; -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/TimeSeriesPrognosis/ITimeSeriesPrognosisSolution.cs
r14186 r14939 28 28 IEnumerable<IEnumerable<double>> GetPrognosedValues(IEnumerable<int> rows, IEnumerable<int> horizon); 29 29 30 IEnumerable<double> PrognosedTestValues { get; } 31 30 32 double TrainingTheilsUStatisticAR1 { get; } 31 33 double TestTheilsUStatisticAR1 { get; }
Note: See TracChangeset
for help on using the changeset viewer.