Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13517


Ignore:
Timestamp:
01/15/16 17:14:26 (9 years ago)
Author:
pfleck
Message:

#2559

  • Correctly adapt training and test partition when inserting and deleting rows.
  • Fixed problem with correlation matrix.
  • Fixed bug within value frequency calculation for histogram.
Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingDataTableView.cs

    r13502 r13517  
    745745
    746746      //  shift the chart to the left so the bars are placed on the intervals
    747       if (Classification != null || valueFrequencies.First().Item1 < doubleRange.First()) {
     747      if (Classification != null || (valueFrequencies.Any() && valueFrequencies.First().Item1 < doubleRange.First())) {
    748748        series.Points.Add(new DataPoint(min - intervalWidth, 0));
    749749        series.Points.Add(new DataPoint(max + intervalWidth, 0));
  • trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/CorrelationMatrixContent.cs

    r13508 r13517  
    3939    public DataAnalysisProblemData ProblemData {
    4040      get {
    41         return (DataAnalysisProblemData)Context.CreateNewProblemData();
    42         //var creator = new ProblemDataCreator(Context);
    43         //return (DataAnalysisProblemData)creator.CreateProblemData();
     41        var problemData = (DataAnalysisProblemData)Context.CreateNewProblemData();
     42        foreach (var input in problemData.InputVariables)
     43          problemData.InputVariables.SetItemCheckedState(input, true);
     44        // CorrelationView hides non-input columns per default
     45        return problemData;
    4446      }
    4547    }
  • trunk/sources/HeuristicLab.DataPreprocessing/3.4/Data/TransactionalPreprocessingData.cs

    r13508 r13517  
    216216    }
    217217
     218
     219    public override void InsertRow(int rowIndex) {
     220      SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
     221      foreach (IList column in variableValues) {
     222        Type type = column.GetType().GetGenericArguments()[0];
     223        column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null);
     224      }
     225      if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) {
     226        TrainingPartition.End++;
     227        if (TrainingPartition.End <= TestPartition.Start) {
     228          TestPartition.Start++;
     229          TestPartition.End++;
     230        }
     231      } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) {
     232        TestPartition.End++;
     233        if (TestPartition.End <= TrainingPartition.Start) {
     234          TestPartition.Start++;
     235          TestPartition.End++;
     236        }
     237      }
     238      if (!IsInTransaction)
     239        OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
     240    }
     241    public override void DeleteRow(int rowIndex) {
     242      SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
     243      foreach (IList column in variableValues) {
     244        column.RemoveAt(rowIndex);
     245      }
     246      if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) {
     247        TrainingPartition.End--;
     248        if (TrainingPartition.End <= TestPartition.Start) {
     249          TestPartition.Start--;
     250          TestPartition.End--;
     251        }
     252      } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) {
     253        TestPartition.End--;
     254        if (TestPartition.End <= TrainingPartition.Start) {
     255          TestPartition.Start--;
     256          TestPartition.End--;
     257        }
     258      }
     259      if (!IsInTransaction)
     260        OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
     261    }
    218262    public override void DeleteRowsWithIndices(IEnumerable<int> rows) {
    219263      SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, -1);
     
    222266          column.RemoveAt(rowIndex);
    223267        }
     268        if (TrainingPartition.Start <= rowIndex && rowIndex <= TrainingPartition.End) {
     269          TrainingPartition.End--;
     270          if (TrainingPartition.End <= TestPartition.Start) {
     271            TestPartition.Start--;
     272            TestPartition.End--;
     273          }
     274        } else if (TestPartition.Start <= rowIndex && rowIndex <= TestPartition.End) {
     275          TestPartition.End--;
     276          if (TestPartition.End <= TrainingPartition.Start) {
     277            TestPartition.Start--;
     278            TestPartition.End--;
     279          }
     280        }
    224281      }
    225282      if (!IsInTransaction)
    226283        OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, -1);
    227       ResetPartitions();
    228     }
    229 
    230     public override void InsertRow(int rowIndex) {
    231       SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
    232       foreach (IList column in variableValues) {
    233         Type type = column.GetType().GetGenericArguments()[0];
    234         column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null);
    235       }
    236       if (!IsInTransaction)
    237         OnChanged(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
    238       ResetPartitions();
    239     }
    240 
    241     public override void DeleteRow(int rowIndex) {
    242       SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex);
    243       foreach (IList column in variableValues) {
    244         column.RemoveAt(rowIndex);
    245       }
    246       if (!IsInTransaction)
    247         OnChanged(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex);
    248       ResetPartitions();
    249284    }
    250285
     
    308343      if (listeners != null) listeners(this, EventArgs.Empty);
    309344    }
    310 
    311 
    312     private void ResetPartitions() {
    313       TrainingPartition = new IntRange();
    314       TestPartition = new IntRange();
    315     }
    316 
    317345    #endregion
    318346
Note: See TracChangeset for help on using the changeset viewer.