Changeset 14027 for stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis
- Timestamp:
- 07/08/16 14:37:15 (8 years ago)
- Location:
- stable
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13826,13921-13922,13941,13992-13993,14000
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis merged: 13826,13921,13941,13992-13993,14000
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/Models/ConstantTimeSeriesPrognosisModel.cs
r13156 r14027 39 39 } 40 40 41 public ConstantTimeSeriesPrognosisModel(double constant ) : base(constant) { }41 public ConstantTimeSeriesPrognosisModel(double constant, string targetVariable) : base(constant, targetVariable) { } 42 42 43 43 public IEnumerable<IEnumerable<double>> GetPrognosedValues(IDataset dataset, IEnumerable<int> rows, IEnumerable<int> horizons) { -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/Models/TimeSeriesPrognosisAutoRegressiveModel.cs
r12702 r14027 30 30 [StorableClass] 31 31 [Item("Autoregressive TimeSeries Model", "A linear autoregressive time series model used to predict future values.")] 32 public class TimeSeriesPrognosisAutoRegressiveModel : NamedItem, ITimeSeriesPrognosisModel { 32 public class TimeSeriesPrognosisAutoRegressiveModel : RegressionModel, ITimeSeriesPrognosisModel { 33 public override IEnumerable<string> VariablesUsedForPrediction { 34 get { return new[] { TargetVariable }; } 35 } 36 33 37 [Storable] 34 38 public double[] Phi { get; private set; } 35 39 [Storable] 36 40 public double Constant { get; private set; } 37 [Storable]38 public string TargetVariable { get; private set; }39 41 40 42 public int TimeOffset { get { return Phi.Length; } } … … 46 48 this.Phi = (double[])original.Phi.Clone(); 47 49 this.Constant = original.Constant; 48 this.TargetVariable = original.TargetVariable;49 50 } 50 51 public override IDeepCloneable Clone(Cloner cloner) { … … 52 53 } 53 54 public TimeSeriesPrognosisAutoRegressiveModel(string targetVariable, double[] phi, double constant) 54 : base( "AR(1) Model") {55 : base(targetVariable, "AR(1) Model") { 55 56 Phi = (double[])phi.Clone(); 56 57 Constant = constant; 57 TargetVariable = targetVariable;58 58 } 59 59 … … 91 91 } 92 92 93 public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {93 public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) { 94 94 var targetVariables = dataset.GetReadOnlyDoubleValues(TargetVariable); 95 95 foreach (int row in rows) { … … 111 111 return new TimeSeriesPrognosisSolution(this, new TimeSeriesPrognosisProblemData(problemData)); 112 112 } 113 public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {113 public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 114 114 throw new NotSupportedException(); 115 115 } -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisResults.cs
r13156 r14027 373 373 //mean model 374 374 double trainingMean = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices).Average(); 375 var meanModel = new ConstantModel(trainingMean );375 var meanModel = new ConstantModel(trainingMean, problemData.TargetVariable); 376 376 377 377 //AR1 model … … 395 395 PrognosisTrainingMeanAbsoluteError = errorState == OnlineCalculatorError.None ? trainingMAE : double.NaN; 396 396 double trainingR = OnlinePearsonsRCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 397 PrognosisTrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR *trainingR : double.NaN;397 PrognosisTrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR * trainingR : double.NaN; 398 398 double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 399 399 PrognosisTrainingRelativeError = errorState == OnlineCalculatorError.None ? trainingRelError : double.NaN; … … 431 431 PrognosisTestMeanAbsoluteError = errorState == OnlineCalculatorError.None ? testMAE : double.NaN; 432 432 double testR = OnlinePearsonsRCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 433 PrognosisTestRSquared = errorState == OnlineCalculatorError.None ? testR *testR : double.NaN;433 PrognosisTestRSquared = errorState == OnlineCalculatorError.None ? testR * testR : double.NaN; 434 434 double testRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 435 435 PrognosisTestRelativeError = errorState == OnlineCalculatorError.None ? testRelError : double.NaN; … … 448 448 //mean model 449 449 double trainingMean = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices).Average(); 450 var meanModel = new ConstantModel(trainingMean );450 var meanModel = new ConstantModel(trainingMean, problemData.TargetVariable); 451 451 452 452 //AR1 model -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionBase.cs
r13156 r14027 150 150 OnlineCalculatorError errorState; 151 151 double trainingMean = ProblemData.TrainingIndices.Any() ? ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).Average() : double.NaN; 152 var meanModel = new ConstantModel(trainingMean );152 var meanModel = new ConstantModel(trainingMean,ProblemData.TargetVariable); 153 153 154 154 double alpha, beta;
Note: See TracChangeset
for help on using the changeset viewer.