Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/11/13 16:28:05 (11 years ago)
Author:
tsteinre
Message:
  • implemented ExportToDataset for IPreprocessingData
Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/DataPreprocessingView.cs

    r10219 r10220  
    2525    private void button1_Click(object sender, System.EventArgs e) {
    2626
     27      IPreprocessingData Data = Content.Data;
    2728
    28       /*
    29       DataAnalysisProblemData problemData = Content;
    30       Dataset ds = problemData.Dataset;
    31       for (int i = 0; i < ds.Columns; i++) {
    32         for (int j = 0; j < ds.Rows; j++) {
    33           ds.SetValue("1,0", j, i);
     29      foreach (string variable in Data.VariableNames) {
     30        for (int j = 0; j < Data.Rows; j++) {
     31          // assume: all double
     32          Data.SetCell(variable, j, 1.0);
    3433        }
    3534      }
    3635
    37       MessageBox.Show("Success ;)");
    38       */
     36      MessageBox.Show("Success, now cloning... ");
     37
     38
     39      //Dataset ds = Data.ExportToDataset();
     40      //var cloner = new Cloner();
     41
     42      //cloner.RegisterClonedObject()
     43
     44      //var clone = null;
     45
    3946    }
    4047  }
  • 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
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingData.cs

    r10218 r10220  
    2222using System.Collections.Generic;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
    2425using HeuristicLab.Problems.DataAnalysis;
    25 using HeuristicLab.Data;
    2626
    2727namespace HeuristicLab.DataPreprocessing {
     
    3636    void InsertRow(int rowIndex);
    3737    void DeleteRow(int rowIndex);
    38 
    39     IntRange TrainingPartition { get; }
    40     IntRange TestPartition { get; }
    4138
    4239    void InsertColumn<T>(string variableName, int columnIndex);
     
    6360
    6461    bool IsMissingValue(string variableName, int rowIndex);
     62
     63    Dataset ExportToDataset();
    6564  }
    6665}
Note: See TracChangeset for help on using the changeset viewer.