Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/16 14:37:15 (8 years ago)
Author:
mkommend
Message:

#2604: Merged r13826,r13921, r13922, r13941, r13992, r13993, r14000 intos table.

Location:
stable
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis

  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/Models/ConstantTimeSeriesPrognosisModel.cs

    r13156 r14027  
    3939    }
    4040
    41     public ConstantTimeSeriesPrognosisModel(double constant) : base(constant) { }
     41    public ConstantTimeSeriesPrognosisModel(double constant, string targetVariable) : base(constant, targetVariable) { }
    4242
    4343    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  
    3030  [StorableClass]
    3131  [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
    3337    [Storable]
    3438    public double[] Phi { get; private set; }
    3539    [Storable]
    3640    public double Constant { get; private set; }
    37     [Storable]
    38     public string TargetVariable { get; private set; }
    3941
    4042    public int TimeOffset { get { return Phi.Length; } }
     
    4648      this.Phi = (double[])original.Phi.Clone();
    4749      this.Constant = original.Constant;
    48       this.TargetVariable = original.TargetVariable;
    4950    }
    5051    public override IDeepCloneable Clone(Cloner cloner) {
     
    5253    }
    5354    public TimeSeriesPrognosisAutoRegressiveModel(string targetVariable, double[] phi, double constant)
    54       : base("AR(1) Model") {
     55      : base(targetVariable, "AR(1) Model") {
    5556      Phi = (double[])phi.Clone();
    5657      Constant = constant;
    57       TargetVariable = targetVariable;
    5858    }
    5959
     
    9191    }
    9292
    93     public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
     93    public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
    9494      var targetVariables = dataset.GetReadOnlyDoubleValues(TargetVariable);
    9595      foreach (int row in rows) {
     
    111111      return new TimeSeriesPrognosisSolution(this, new TimeSeriesPrognosisProblemData(problemData));
    112112    }
    113     public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
     113    public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
    114114      throw new NotSupportedException();
    115115    }
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisResults.cs

    r13156 r14027  
    373373      //mean model
    374374      double trainingMean = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices).Average();
    375       var meanModel = new ConstantModel(trainingMean);
     375      var meanModel = new ConstantModel(trainingMean, problemData.TargetVariable);
    376376
    377377      //AR1 model
     
    395395      PrognosisTrainingMeanAbsoluteError = errorState == OnlineCalculatorError.None ? trainingMAE : double.NaN;
    396396      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;
    398398      double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState);
    399399      PrognosisTrainingRelativeError = errorState == OnlineCalculatorError.None ? trainingRelError : double.NaN;
     
    431431      PrognosisTestMeanAbsoluteError = errorState == OnlineCalculatorError.None ? testMAE : double.NaN;
    432432      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;
    434434      double testRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState);
    435435      PrognosisTestRelativeError = errorState == OnlineCalculatorError.None ? testRelError : double.NaN;
     
    448448        //mean model
    449449        double trainingMean = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices).Average();
    450         var meanModel = new ConstantModel(trainingMean);
     450        var meanModel = new ConstantModel(trainingMean, problemData.TargetVariable);
    451451
    452452        //AR1 model
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionBase.cs

    r13156 r14027  
    150150      OnlineCalculatorError errorState;
    151151      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);
    153153
    154154      double alpha, beta;
Note: See TracChangeset for help on using the changeset viewer.