Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10194


Ignore:
Timestamp:
12/04/13 17:01:13 (11 years ago)
Author:
pfleck
Message:

Implemented InsertRow, DeleteRow, InsertColumn, DeleteColumn in PreprocessingData.

Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
2 edited

Legend:

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

    r10193 r10194  
    7373
    7474      trainingToTestRatio = (double)problemData.TrainingPartition.Size / problemData.TestPartition.Size;
    75       Columns = problemData.Dataset.Columns;
    76       Rows = problemData.Dataset.Rows;
    7775    }
    7876
     
    104102
    105103    public IEnumerable<T> GetValues<T>(string variableName) {
    106         return (IEnumerable<T>)variableValues[variableName];
     104      // TODO: test if cast is valid
     105      return (IEnumerable<T>)variableValues[variableName];
    107106    }
    108107
     
    112111
    113112    public void InsertRow(int rowIndex) {
    114       throw new NotImplementedException();
     113      foreach (IList column in variableValues.Values) {
     114        Type type = column.GetType().GetGenericArguments()[0];
     115
     116        column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null);
     117      }
    115118    }
    116119
    117120    public void DeleteRow(int rowIndex) {
    118       throw new NotImplementedException();
     121      foreach (IList column in variableValues.Values) {
     122        column.RemoveAt(rowIndex);
     123      }
    119124    }
    120125
    121     public void InsertColumn(string variableName, int columnIndex) {
    122       throw new NotImplementedException();
     126    public void InsertColumn<T>(string variableName, int columnIndex) {
     127      variableValues.Add(variableName, new List<T>(Rows));
     128      variableNameIndices.Add(variableName, columnIndex);
     129      variableNames.Insert(columnIndex, variableName);
    123130    }
    124131
    125132    public void DeleteColumn(string variableName) {
    126       throw new NotImplementedException();
     133      variableValues.Remove(variableName);
     134      variableNames.RemoveAt(variableNameIndices[variableName]);
     135      variableNameIndices.Remove(variableName);
    127136    }
    128137
     
    136145
    137146    public int Columns {
    138       get;
    139       private set;
     147      get { return variableNames.Count; }
    140148    }
    141149
    142150    public int Rows {
    143       get;
    144       private set;
     151      get { return variableValues.Count; }
    145152    }
    146 
    147     public void ExportTo(IDataAnalysisProblemData problemData) {
    148       throw new NotImplementedException();
    149     }
    150 
    151153    public IDictionary<string, IEnumerable<int>> GetMissingValueIndices() {
    152154      var dic = new Dictionary<string, IEnumerable<int>>();
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingData.cs

    r10191 r10194  
    3636    void DeleteRow(int rowIndex);
    3737
    38     void InsertColumn(string variableName, int columnIndex);
     38    void InsertColumn<T>(string variableName, int columnIndex);
    3939    void DeleteColumn(string variableName);
    4040
     
    4444    int Columns { get; }
    4545    int Rows { get; }
    46 
    47     void ExportTo(IDataAnalysisProblemData problemData);
    4846
    4947    /// <summary>
Note: See TracChangeset for help on using the changeset viewer.