Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/07/13 17:00:16 (11 years ago)
Author:
bburlacu
Message:

#1837: Merged trunk changes and fixed sliding window visualization.

Location:
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowData.cs

    r9162 r9870  
    3232  [Item("Sliding Window Position", "")]
    3333  public sealed class SlidingWindowData : Item {
    34 
    3534    [Storable]
    3635    private IntRange slidingWindowPosition;
     
    3938    }
    4039
    41     [Storable]
    42     private IEnumerable<double> targetValues;
    4340    public IEnumerable<double> TargetValues {
    44       get { return targetValues; }
     41      get {
     42        return problemData.Dataset.GetDoubleValues(GetTargetVariableName(problemData), problemData.TrainingIndices);
     43      }
    4544    }
    4645
     
    5655    }
    5756
     57    [Storable]
     58    private readonly IDataAnalysisProblemData problemData;
     59
     60    public IDataAnalysisProblemData ProblemData {
     61      get { return problemData; }
     62    }
     63
     64    public int TrainingPartitionStart {
     65      get { return problemData.TrainingPartition.Start; }
     66    }
     67
     68    public int TrainingPartitionEnd {
     69      get { return problemData.TrainingPartition.End; }
     70    }
     71
    5872    [StorableConstructor]
    5973    private SlidingWindowData(bool deserializing) : base(deserializing) { }
     
    6175      : base(original, cloner) {
    6276      slidingWindowPosition = cloner.Clone(original.slidingWindowPosition);
    63       targetValues = new List<double>(original.targetValues);
     77      problemData = cloner.Clone(original.ProblemData);
    6478    }
    6579    public override IDeepCloneable Clone(Cloner cloner) {
     
    6781    }
    6882
    69     public SlidingWindowData(IntRange slidingWindowPosition, IEnumerable<double> targetValues)
     83    public SlidingWindowData(IntRange slidingWindowPosition, IDataAnalysisProblemData problemData)
    7084      : base() {
    7185      this.slidingWindowPosition = slidingWindowPosition;
    72       this.targetValues = targetValues.ToArray();
     86      this.problemData = (IDataAnalysisProblemData)problemData.Clone();
    7387    }
    7488
     
    7892      if (handler != null) EstimatedValuesChanged(this, EventArgs.Empty);
    7993    }
     94
     95    private string GetTargetVariableName(IDataAnalysisProblemData problemData) {
     96      var classificationProblemData = problemData as IClassificationProblemData;
     97      var regressionProblemData = problemData as IRegressionProblemData;
     98      string targetVariable;
     99      if (classificationProblemData != null) targetVariable = classificationProblemData.TargetVariable;
     100      else if (regressionProblemData != null) targetVariable = regressionProblemData.TargetVariable;
     101      else throw new NotSupportedException();
     102      return targetVariable;
     103    }
    80104  }
    81105}
Note: See TracChangeset for help on using the changeset viewer.