Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8764 for branches


Ignore:
Timestamp:
10/09/12 12:01:53 (12 years ago)
Author:
mkommend
Message:

#1081: Removed wrong MA models from timeseries prognosis branch.

Location:
branches/HeuristicLab.TimeSeries
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionErrorCharacteristicsCurveView.cs

    r8487 r8764  
    5050      base.UpdateChart();
    5151      if (Content == null) return;
    52       var movingAverageModel = new TimeSeriesPrognosisMovingAverageModel(10, Content.ProblemData.TargetVariable).CreateTimeSeriesPrognosisSolution(ProblemData);
    53       movingAverageModel.Name = "Moving average Model";
    54       AddRegressionSolution(movingAverageModel);
    5552
    5653      //AR1 model
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r8750 r8764  
    149149    <Compile Include="Implementation\Regression\RegressionEnsembleSolution.cs" />
    150150    <Compile Include="Implementation\TimeSeriesPrognosis\Models\ConstantTimeSeriesPrognosisModel.cs" />
    151     <Compile Include="Implementation\TimeSeriesPrognosis\Models\TimeSeriesPrognosisMovingAverageModel.cs" />
    152151    <Compile Include="Implementation\TimeSeriesPrognosis\Models\TimeSeriesPrognosisAutoRegressiveModel.cs" />
    153152    <Compile Include="Implementation\TimeSeriesPrognosis\TimeSeriesPrognosisProblem.cs" />
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisResults.cs

    r8762 r8764  
    5555    protected const string PrognosisTrainingTheilsUStatisticMeanResultName = "Theil's U2 (mean) (training)";
    5656    protected const string PrognosisTestTheilsUStatisticMeanResultName = "Theil's U2 (mean) (test)";
    57     protected const string PrognosisTrainingTheilsUStatisticMovingAverageResultName = "Theil's U2 (moving average) (training)";
    58     protected const string PrognosisTestTheilsUStatisticMovingAverageResultName = "Theil's U2 (moving average) (test)";
    5957    #endregion
    6058
     
    8179    protected const string PrognosisTrainingTheilsUStatisticMeanResultDescription = "The Theil's U statistic (reference: mean model) of the forecasts of the model on the training partition";
    8280    protected const string PrognosisTestTheilsUStatisticMeanResultDescription = "The Theil's U statistic (reference: mean value) of the forecasts of the model on the test partition";
    83     protected const string PrognosisTrainingTheilsUStatisticMovingAverageResultDescription = "The Theil's U statistic (reference: moving average model) of the forecasts of the model on the training partition";
    84     protected const string PrognosisTestTheilsUStatisticMovingAverageResultDescription = "The Theil's U statistic (reference: moving average model) of the forecasts of the model on the test partition";
    8581    #endregion
    8682
     
    298294        if (!ContainsKey(PrognosisTestTheilsUStatisticMeanResultName)) Add(new Result(PrognosisTestTheilsUStatisticMeanResultName, PrognosisTestTheilsUStatisticMeanResultDescription, new DoubleValue()));
    299295        ((DoubleValue)this[PrognosisTestTheilsUStatisticMeanResultName].Value).Value = value;
    300       }
    301     }
    302     public double PrognosisTrainingTheilsUStatisticMovingAverage {
    303       get {
    304         if (!ContainsKey(PrognosisTrainingTheilsUStatisticMovingAverageResultName)) return double.NaN;
    305         return ((DoubleValue)this[PrognosisTrainingTheilsUStatisticMovingAverageResultName].Value).Value;
    306       }
    307       private set {
    308         if (!ContainsKey(PrognosisTrainingTheilsUStatisticMovingAverageResultName)) Add(new Result(PrognosisTrainingTheilsUStatisticMovingAverageResultName, PrognosisTrainingTheilsUStatisticMovingAverageResultDescription, new DoubleValue()));
    309         ((DoubleValue)this[PrognosisTrainingTheilsUStatisticMovingAverageResultName].Value).Value = value;
    310       }
    311     }
    312     public double PrognosisTestTheilsUStatisticMovingAverage {
    313       get {
    314         if (!ContainsKey(PrognosisTestTheilsUStatisticMovingAverageResultName)) return double.NaN;
    315         return ((DoubleValue)this[PrognosisTestTheilsUStatisticMovingAverageResultName].Value).Value;
    316       }
    317       private set {
    318         if (!ContainsKey(PrognosisTestTheilsUStatisticMovingAverageResultName)) Add(new Result(PrognosisTestTheilsUStatisticMovingAverageResultName, PrognosisTestTheilsUStatisticMovingAverageResultDescription, new DoubleValue()));
    319         ((DoubleValue)this[PrognosisTestTheilsUStatisticMovingAverageResultName].Value).Value = value;
    320296      }
    321297    }
     
    399375      var AR1model = new TimeSeriesPrognosisAutoRegressiveModel(problemData.TargetVariable, new double[] { beta }, alpha);
    400376
    401       //MA model
    402       const int movingAverageWindowSize = 10;
    403       var MovingAverageModel = new TimeSeriesPrognosisMovingAverageModel(movingAverageWindowSize, problemData.TargetVariable);
    404 
    405377      var trainingHorizions = problemData.TrainingIndices.Select(r => Math.Min(trainingHorizon, problemData.TrainingPartition.End - r)).ToList();
    406378      IEnumerable<IEnumerable<double>> trainingTargetValues = problemData.TrainingIndices.Zip(trainingHorizions, Enumerable.Range).Select(r => problemData.Dataset.GetDoubleValues(problemData.TargetVariable, r)).ToList();
     
    408380      IEnumerable<IEnumerable<double>> trainingMeanModelPredictions = meanModel.GetPrognosedValues(problemData.Dataset, problemData.TrainingIndices, trainingHorizions).ToList();
    409381      IEnumerable<IEnumerable<double>> trainingAR1ModelPredictions = AR1model.GetPrognosedValues(problemData.Dataset, problemData.TrainingIndices, trainingHorizions).ToList();
    410       IEnumerable<IEnumerable<double>> trainingMovingAverageModelPredictions = MovingAverageModel.GetPrognosedValues(problemData.Dataset, problemData.TrainingIndices, trainingHorizions).ToList();
    411382
    412383      IEnumerable<double> originalTrainingValues = trainingTargetValues.SelectMany(x => x).ToList();
     
    434405      PrognosisTrainingTheilsUStatisticMean = OnlineTheilsUStatisticCalculator.Calculate(trainingStartValues, trainingTargetValues, trainingMeanModelPredictions, trainingEstimatedValues, out errorState);
    435406      PrognosisTrainingTheilsUStatisticMean = errorState == OnlineCalculatorError.None ? PrognosisTrainingTheilsUStatisticMean : double.PositiveInfinity;
    436       PrognosisTrainingTheilsUStatisticMovingAverage = OnlineTheilsUStatisticCalculator.Calculate(trainingStartValues, trainingTargetValues, trainingMovingAverageModelPredictions, trainingEstimatedValues, out errorState);
    437       PrognosisTrainingTheilsUStatisticMovingAverage = errorState == OnlineCalculatorError.None ? PrognosisTrainingTheilsUStatisticMovingAverage : double.PositiveInfinity;
    438407    }
    439408
     
    452421      var AR1model = new TimeSeriesPrognosisAutoRegressiveModel(problemData.TargetVariable, new double[] { beta }, alpha);
    453422
    454       //MA model
    455       const int movingAverageWindowSize = 10;
    456       var MovingAverageModel = new TimeSeriesPrognosisMovingAverageModel(movingAverageWindowSize, problemData.TargetVariable);
    457 
    458423      var testHorizions = problemData.TestIndices.Select(r => Math.Min(testHorizon, problemData.TestPartition.End - r)).ToList();
    459424      IEnumerable<IEnumerable<double>> testTargetValues = problemData.TestIndices.Zip(testHorizions, Enumerable.Range).Select(r => problemData.Dataset.GetDoubleValues(problemData.TargetVariable, r)).ToList();
     
    462427      IEnumerable<IEnumerable<double>> testMeanModelPredictions = meanModel.GetPrognosedValues(problemData.Dataset, problemData.TestIndices, testHorizions).ToList();
    463428      IEnumerable<IEnumerable<double>> testAR1ModelPredictions = AR1model.GetPrognosedValues(problemData.Dataset, problemData.TestIndices, testHorizions).ToList();
    464       IEnumerable<IEnumerable<double>> testMovingAverageModelPredictions = MovingAverageModel.GetPrognosedValues(problemData.Dataset, problemData.TestIndices, testHorizions).ToList();
    465429
    466430      IEnumerable<double> originalTestValues = testTargetValues.SelectMany(x => x).ToList();
     
    488452      PrognosisTestTheilsUStatisticMean = OnlineTheilsUStatisticCalculator.Calculate(testStartValues, testTargetValues, testMeanModelPredictions, testEstimatedValues, out errorState);
    489453      PrognosisTestTheilsUStatisticMean = errorState == OnlineCalculatorError.None ? PrognosisTestTheilsUStatisticMean : double.PositiveInfinity;
    490       PrognosisTestTheilsUStatisticMovingAverage = OnlineTheilsUStatisticCalculator.Calculate(testStartValues, testTargetValues, testMovingAverageModelPredictions, testEstimatedValues, out errorState);
    491       PrognosisTestTheilsUStatisticMovingAverage = errorState == OnlineCalculatorError.None ? PrognosisTestTheilsUStatisticMovingAverage : double.PositiveInfinity;
    492454    }
    493455  }
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionBase.cs

    r8750 r8764  
    3939    protected const string TrainingTheilsUStatisticMeanResultName = "Theil's U2 (mean) (training)";
    4040    protected const string TestTheilsUStatisticMeanResultName = "Theil's U2 (mean) (test)";
    41     protected const string TrainingTheilsUStatisticMovingAverageResultName = "Theil's U2 (moving average) (training)";
    42     protected const string TestTheilsUStatisticMovingAverageResultName = "Theil's U2 (moving average) (test)";
    4341    protected const string TimeSeriesPrognosisResultName = "Prognosis Results";
    4442    #endregion
     
    5351    protected const string TrainingTheilsUStatisticMeanResultDescription = "The Theil's U statistic (reference: mean model) of the forecasts of the model on the training partition";
    5452    protected const string TestTheilsUStatisticMeanResultDescription = "The Theil's U statistic (reference: mean value) of the forecasts of the model on the test partition";
    55     protected const string TrainingTheilsUStatisticMovingAverageResultDescription = "The Theil's U statistic (reference: moving average model) of the forecasts of the model on the training partition";
    56     protected const string TestTheilsUStatisticMovingAverageResultDescription = "The Theil's U statistic (reference: moving average model) of the forecasts of the model on the test partition";
    5753    protected const string TimeSeriesPrognosisResultDescription = "The calculated results of predictions in the future.";
    5854    #endregion
     
    10399      private set { ((DoubleValue)this[TestTheilsUStatisticMeanResultName].Value).Value = value; }
    104100    }
    105     public double TrainingTheilsUStatisticMovingAverage {
    106       get { return ((DoubleValue)this[TrainingTheilsUStatisticMovingAverageResultName].Value).Value; }
    107       private set { ((DoubleValue)this[TrainingTheilsUStatisticMovingAverageResultName].Value).Value = value; }
    108     }
    109     public double TestTheilsUStatisticMovingAverage {
    110       get { return ((DoubleValue)this[TestTheilsUStatisticMovingAverageResultName].Value).Value; }
    111       private set { ((DoubleValue)this[TestTheilsUStatisticMovingAverageResultName].Value).Value = value; }
    112     }
    113101
    114102    public TimeSeriesPrognosisResults TimeSeriesPrognosisResults {
     
    151139      Add(new Result(TrainingTheilsUStatisticMeanResultName, TrainingTheilsUStatisticMeanResultDescription, new DoubleValue()));
    152140      Add(new Result(TestTheilsUStatisticMeanResultName, TestTheilsUStatisticMeanResultDescription, new DoubleValue()));
    153       Add(new Result(TrainingTheilsUStatisticMovingAverageResultName, TrainingTheilsUStatisticMovingAverageResultDescription, new DoubleValue()));
    154       Add(new Result(TestTheilsUStatisticMovingAverageResultName, TestTheilsUStatisticMovingAverageResultDescription, new DoubleValue()));
    155141    }
    156142
     
    171157      var AR1model = new TimeSeriesPrognosisAutoRegressiveModel(ProblemData.TargetVariable, new double[] { beta }, alpha);
    172158
    173       //MA model
    174       const int movingAverageWindowSize = 10;
    175       var movingAverageModel = new TimeSeriesPrognosisMovingAverageModel(movingAverageWindowSize, ProblemData.TargetVariable);
    176159
    177160      #region Calculate training quality measures
     
    180163      IEnumerable<double> trainingMeanModelPredictions = meanModel.GetEstimatedValues(ProblemData.Dataset, ProblemData.TrainingIndices).ToList();
    181164      IEnumerable<double> trainingAR1ModelPredictions = AR1model.GetEstimatedValues(ProblemData.Dataset, ProblemData.TrainingIndices).ToList();
    182       IEnumerable<double> trainingMovingAverageModelPredictions = movingAverageModel.GetEstimatedValues(ProblemData.Dataset, ProblemData.TrainingIndices).ToList();
    183165
    184166      TrainingDirectionalSymmetry = OnlineDirectionalSymmetryCalculator.Calculate(trainingTargetValues.First(), trainingTargetValues, trainingEstimatedValues, out errorState);
     
    190172      TrainingTheilsUStatisticMean = OnlineTheilsUStatisticCalculator.Calculate(trainingTargetValues.First(), trainingTargetValues, trainingMeanModelPredictions, trainingEstimatedValues, out errorState);
    191173      TrainingTheilsUStatisticMean = errorState == OnlineCalculatorError.None ? TrainingTheilsUStatisticMean : double.PositiveInfinity;
    192       TrainingTheilsUStatisticMovingAverage = OnlineTheilsUStatisticCalculator.Calculate(trainingTargetValues.First(), trainingTargetValues, trainingMovingAverageModelPredictions, trainingEstimatedValues, out errorState);
    193       TrainingTheilsUStatisticMovingAverage = errorState == OnlineCalculatorError.None ? TrainingTheilsUStatisticMovingAverage : double.PositiveInfinity;
    194174      #endregion
    195175
     
    199179      IEnumerable<double> testMeanModelPredictions = meanModel.GetEstimatedValues(ProblemData.Dataset, ProblemData.TestIndices).ToList();
    200180      IEnumerable<double> testAR1ModelPredictions = AR1model.GetEstimatedValues(ProblemData.Dataset, ProblemData.TestIndices).ToList();
    201       IEnumerable<double> testMovingAverageModelPredictions = movingAverageModel.GetEstimatedValues(ProblemData.Dataset, ProblemData.TestIndices).ToList();
    202181
    203182      TestDirectionalSymmetry = OnlineDirectionalSymmetryCalculator.Calculate(testTargetValues.First(), testTargetValues, testEstimatedValues, out errorState);
     
    209188      TestTheilsUStatisticMean = OnlineTheilsUStatisticCalculator.Calculate(testTargetValues.First(), testTargetValues, testMeanModelPredictions, testEstimatedValues, out errorState);
    210189      TestTheilsUStatisticMean = errorState == OnlineCalculatorError.None ? TestTheilsUStatisticMean : double.PositiveInfinity;
    211       TestTheilsUStatisticMovingAverage = OnlineTheilsUStatisticCalculator.Calculate(testTargetValues.First(), testTargetValues, testMovingAverageModelPredictions, testEstimatedValues, out errorState);
    212       TestTheilsUStatisticMovingAverage = errorState == OnlineCalculatorError.None ? TestTheilsUStatisticMovingAverage : double.PositiveInfinity;
    213190      #endregion
    214191    }
Note: See TracChangeset for help on using the changeset viewer.