Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/11/13 16:28:05 (10 years ago)
Author:
tsteinre
Message:
  • implemented ExportToDataset for IPreprocessingData
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs

    r10218 r10220  
    2626using HeuristicLab.Common;
    2727using HeuristicLab.Core;
     28using HeuristicLab.Data;
    2829using HeuristicLab.Problems.DataAnalysis;
    29 using HeuristicLab.Data;
    3030
    3131namespace HeuristicLab.DataPreprocessing {
     
    4242
    4343    private double trainingToTestRatio;
    44  
     44
    4545    private PreprocessingData(PreprocessingData original, Cloner cloner)
    4646      : base(original, cloner) {
     
    109109    public IEnumerable<T> GetValues<T>(string variableName) {
    110110      // TODO: test if cast is valid
    111       return (IEnumerable<T>)variableValues[variableName]; 
     111      return (IEnumerable<T>)variableValues[variableName];
    112112    }
    113113
     
    183183        return GetValues<string>(variableName).Select((s, i) => new { i, s }).Where(t => string.IsNullOrEmpty(t.s)).Select(t => t.i);
    184184      } else if (IsType<DateTime>(variableName)) {
    185           return GetValues<DateTime>(variableName).Select((s, i) => new { i, s }).Where(t => t.s.Equals(DateTime.MinValue)).Select(t => t.i);
     185        return GetValues<DateTime>(variableName).Select((s, i) => new { i, s }).Where(t => t.s.Equals(DateTime.MinValue)).Select(t => t.i);
    186186      } else {
    187187        throw new ArgumentException("column with variableName: " + variableName + " contains a non supported type.");
    188188      }
     189    }
     190
     191    #endregion
     192
     193    #region IPreprocessingData Members
     194
     195    public Dataset ExportToDataset() {
     196      IList<IList> values = new List<IList>();
     197      foreach (var variable in VariableNames) {
     198        values.Add(variableValues[variable]);
     199      }
     200
     201      var dataset = new Dataset(variableNames, values);
     202      return dataset;
    189203    }
    190204
Note: See TracChangeset for help on using the changeset viewer.