Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/24/12 16:37:40 (13 years ago)
Author:
sforsten
Message:

#1784:

  • deleted ClassificationData and RegressionData. RegressionProblemData and ClassificationProblemData are used instead
  • deleted not needed Transformer
  • ValueGenerator is now a static class and yield return is used return IEnumerable
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblem.cs

    r7758 r7759  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    2522using HeuristicLab.Common;
    2623using HeuristicLab.Core;
     
    3330  [Creatable("Problems")]
    3431  public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>, IRegressionProblem, IStorableContent,
    35     IProblemInstanceConsumer<RegressionData>, IProblemInstanceExporter<RegressionData> {
     32    IProblemInstanceConsumer<RegressionProblemData>, IProblemInstanceExporter<RegressionProblemData> {
    3633    public string Filename { get; set; }
    3734
     
    4643    }
    4744
    48     public void Load(RegressionData data) {
     45    public void Load(RegressionProblemData data) {
    4946      Name = data.Name;
    5047      Description = data.Description;
    51       Dataset dataset = new Dataset(data.InputVariables, data.Values);
    52       ProblemData = new RegressionProblemData(dataset, data.AllowedInputVariables, data.TargetVariable);
    53       ProblemData.TrainingPartition.Start = data.TrainingPartitionStart;
    54       ProblemData.TrainingPartition.End = data.TrainingPartitionEnd;
    55       ProblemData.TestPartition.Start = data.TestPartitionStart;
    56       ProblemData.TestPartition.End = data.TestPartitionEnd;
     48      ProblemData = new RegressionProblemData(data.Dataset, data.AllowedInputVariables, data.TargetVariable);
     49      ProblemData.TrainingPartition.Start = data.TrainingPartition.Start;
     50      ProblemData.TrainingPartition.End = data.TrainingPartition.End;
     51      ProblemData.TestPartition.Start = data.TestPartition.Start;
     52      ProblemData.TestPartition.End = data.TestPartition.End;
    5753      OnReset();
    5854    }
    5955
    60     public RegressionData Export() {
    61       if (!ProblemData.InputVariables.Count.Equals(ProblemData.Dataset.DoubleVariables.Count()))
    62         throw new ArgumentException("Not all input variables are double variables! (Export only works with double variables)");
    63 
    64       RegressionData regData = new RegressionData();
     56    public RegressionProblemData Export() {
     57      RegressionProblemData regData = new RegressionProblemData(ProblemData.Dataset, ProblemData.AllowedInputVariables, ProblemData.TargetVariable);
    6558      regData.Name = Name;
    6659      regData.Description = Description;
    67       regData.TargetVariable = ProblemData.TargetVariable;
    68       regData.InputVariables = ProblemData.InputVariables.Select(x => x.Value).ToArray();
    69       regData.AllowedInputVariables = ProblemData.AllowedInputVariables.ToArray();
    70       regData.TrainingPartitionStart = ProblemData.TrainingPartition.Start;
    71       regData.TrainingPartitionEnd = ProblemData.TrainingPartition.End;
    72       regData.TestPartitionStart = ProblemData.TestPartition.Start;
    73       regData.TestPartitionEnd = ProblemData.TestPartition.End;
    74 
    75       List<List<double>> data = new List<List<double>>();
    76       foreach (var variable in ProblemData.Dataset.DoubleVariables) {
    77         data.Add(ProblemData.Dataset.GetDoubleValues(variable).ToList());
    78       }
    79       regData.Values = Transformer.Transformation(data);
    80 
     60      regData.TrainingPartition.Start = ProblemData.TrainingPartition.Start;
     61      regData.TrainingPartition.End = ProblemData.TrainingPartition.End;
     62      regData.TestPartition.Start = ProblemData.TestPartition.Start;
     63      regData.TestPartition.End = ProblemData.TestPartition.End;
    8164      return regData;
    8265    }
Note: See TracChangeset for help on using the changeset viewer.