Changeset 8762
- Timestamp:
- 10/08/12 16:11:03 (12 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs
r8468 r8762 77 77 /// <param name="timeOffset">The parameter p of the AR(p) specifying the maximum time offset [1,infinity] </param> 78 78 /// <returns>The times series autoregressive solution </returns> 79 public ITimeSeriesPrognosisSolution CreateAutoRegressiveSolution(ITimeSeriesPrognosisProblemData problemData, int timeOffset) {79 public static ITimeSeriesPrognosisSolution CreateAutoRegressiveSolution(ITimeSeriesPrognosisProblemData problemData, int timeOffset) { 80 80 double rmsError, cvRmsError; 81 81 return CreateAutoRegressiveSolution(problemData, timeOffset, out rmsError, out cvRmsError); 82 82 } 83 83 84 internalITimeSeriesPrognosisSolution CreateAutoRegressiveSolution(ITimeSeriesPrognosisProblemData problemData, int timeOffset, out double rmsError, out double cvRmsError) {84 private static ITimeSeriesPrognosisSolution CreateAutoRegressiveSolution(ITimeSeriesPrognosisProblemData problemData, int timeOffset, out double rmsError, out double cvRmsError) { 85 85 string targetVariable = problemData.TargetVariable; 86 86 87 87 double[,] inputMatrix = new double[problemData.TrainingPartition.Size, timeOffset + 1]; 88 var targetValues = problemData.Dataset.Get ReadOnlyDoubleValues(targetVariable);88 var targetValues = problemData.Dataset.GetDoubleValues(targetVariable).ToList(); 89 89 for (int i = 0, row = problemData.TrainingPartition.Start; i < problemData.TrainingPartition.Size; i++, row++) { 90 for (int col = 0; col < timeOffset + 1; col++) {91 inputMatrix[i, col] = targetValues[row - col ];90 for (int col = 0; col < timeOffset; col++) { 91 inputMatrix[i, col] = targetValues[row - col - 1]; 92 92 } 93 93 } 94 // set target values in last column 95 for (int i = 0; i < inputMatrix.GetLength(0); i++) 96 inputMatrix[i, timeOffset] = targetValues[i + problemData.TrainingPartition.Start]; 94 97 95 98 if (inputMatrix.Cast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x))) … … 119 122 120 123 for (int i = 0; i < timeOffset; i++) { 121 LaggedVariableTreeNode node = (LaggedVariableTreeNode)new HeuristicLab.Problems.DataAnalysis.Symbolic.LaggedVariable().CreateTreeNode();124 LaggedVariableTreeNode node = (LaggedVariableTreeNode)new LaggedVariable().CreateTreeNode(); 122 125 node.VariableName = targetVariable; 123 126 node.Weight = coefficients[i]; -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisResults.cs
r8750 r8762 322 322 #endregion 323 323 324 324 [Storable] 325 325 private int trainingHorizon; 326 [Storable]327 326 public int TrainingHorizon { 328 327 get { return trainingHorizon; } … … 335 334 } 336 335 336 [Storable] 337 337 private int testHorizon; 338 [Storable]339 338 public int TestHorizon { 340 339 get { return testHorizon; } … … 351 350 public ITimeSeriesPrognosisSolution Solution { 352 351 get { return solution; } 352 private set { solution = value; } //necessary for persistence 353 353 } 354 354
Note: See TracChangeset
for help on using the changeset viewer.