- Timestamp:
- 07/19/17 14:32:57 (7 years ago)
- Location:
- branches/DataPreprocessing Cleanup
- Files:
-
- 1 added
- 1 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/CheckedTransformationListView.cs
r15110 r15274 51 51 // TODO: Avoid accessing parent view 52 52 var transformationView = (TransformationView)Parent; 53 var columnNames = transformationView.Content. Data.VariableNames;53 var columnNames = transformationView.Content.PreprocessingData.VariableNames; 54 54 55 55 return (ITransformation)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(new[] { columnNames }); -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/DataGridContentView.cs
r15270 r15274 85 85 base.RegisterContentEvents(); 86 86 Content.Changed += Content_Changed; 87 Content. FilterLogic.FilterChanged += FilterLogic_FilterChanged;87 Content.PreprocessingData.FilterChanged += FilterLogic_FilterChanged; 88 88 } 89 89 … … 91 91 base.DeregisterContentEvents(); 92 92 Content.Changed -= Content_Changed; 93 Content. FilterLogic.FilterChanged -= FilterLogic_FilterChanged;93 Content.PreprocessingData.FilterChanged -= FilterLogic_FilterChanged; 94 94 } 95 95 … … 98 98 searchIterator = null; 99 99 if (findAndReplaceDialog != null && !findAndReplaceDialog.IsDisposed) { 100 if (Content. FilterLogic.IsFiltered) {100 if (Content.PreprocessingData.IsFiltered) { 101 101 findAndReplaceDialog.DisableReplace(); 102 102 } else { … … 104 104 } 105 105 } 106 btnReplace.Enabled = !Content. FilterLogic.IsFiltered;106 btnReplace.Enabled = !Content.PreprocessingData.IsFiltered; 107 107 } 108 108 … … 126 126 string errorMessage; 127 127 if (!String.IsNullOrEmpty(e.FormattedValue.ToString())) { 128 if (dataGridView.IsCurrentCellInEditMode && Content. FilterLogic.IsFiltered) {128 if (dataGridView.IsCurrentCellInEditMode && Content.PreprocessingData.IsFiltered) { 129 129 errorMessage = "A filter is active, you cannot modify data. Press ESC to exit edit mode."; 130 130 } else { … … 271 271 searchIterator = null; 272 272 DataGridView.SelectionChanged += DataGridView_SelectionChanged_FindAndReplace; 273 if (Content. FilterLogic.IsFiltered) {273 if (Content.PreprocessingData.IsFiltered) { 274 274 findAndReplaceDialog.DisableReplace(); 275 275 } … … 405 405 ComparisonOperation comparisonOperation = findAndReplaceDialog.GetComparisonOperation(); 406 406 var foundCells = new Dictionary<int, IList<int>>(); 407 for (int i = 0; i < Content. FilterLogic.PreprocessingData.Columns; i++) {407 for (int i = 0; i < Content.PreprocessingData.Columns; i++) { 408 408 var filters = CreateFilters(match, comparisonOperation, i); 409 409 410 bool[] filteredRows = Content.FilterLogic.GetFilterResult(filters, true);410 bool[] filteredRows = GetFilterResult(filters, true); 411 411 var foundIndices = new List<int>(); 412 412 for (int idx = 0; idx < filteredRows.Length; ++idx) { … … 427 427 } 428 428 429 private bool[] GetFilterResult(IList<IFilter> filters, bool isAndCombination) { 430 IList<IFilter> activeFilters = filters.Where(f => f.Active && f.ConstraintData != null).ToList(); 431 432 if (activeFilters.Count == 0) { 433 return Enumerable.Repeat(false, Content.PreprocessingData.Rows).ToArray(); ; 434 } 435 436 var result = Enumerable.Repeat(!isAndCombination, Content.PreprocessingData.Rows).ToArray(); 437 foreach (IFilter filter in activeFilters) { 438 bool[] filterResult = filter.Check(); 439 for (int row = 0; row < result.Length; ++row) { 440 result[row] = isAndCombination ? result[row] || filterResult[row] : result[row] && filterResult[row]; 441 } 442 } 443 return result; 444 } 445 429 446 private List<IFilter> CreateFilters(string match, ComparisonOperation comparisonOperation, int columnIndex) { 430 IPreprocessingData preprocessingData = Content. FilterLogic.PreprocessingData;447 IPreprocessingData preprocessingData = Content.PreprocessingData; 431 448 IStringConvertibleValue value; 432 449 if (preprocessingData.VariableHasType<double>(columnIndex)) { … … 547 564 base.dataGridView_KeyDown(sender, e); 548 565 //data is in read only mode.... 549 if (Content. FilterLogic.IsFiltered) return;566 if (Content.PreprocessingData.IsFiltered) return; 550 567 551 568 if (e.KeyCode == Keys.Delete) { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs
r15269 r15274 49 49 if (Content != null) { 50 50 var data = Content.Data; 51 var filterLogic = new FilterLogic(data);52 51 var statisticsLogic = new StatisticsLogic(data); 53 52 var manipulationLogic = new ManipulationLogic(data, statisticsLogic); 54 53 55 54 var viewShortcuts = new ItemList<IViewShortcut> { 56 new DataGridContent(data, manipulationLogic , filterLogic),55 new DataGridContent(data, manipulationLogic), 57 56 new StatisticsContent(data, statisticsLogic), 58 57 … … 64 63 new DataCompletenessChartContent(data), 65 64 66 new FilterContent( filterLogic),67 new ManipulationContent( manipulationLogic, filterLogic),68 new TransformationContent(data , filterLogic)65 new FilterContent(data), 66 new ManipulationContent(data, manipulationLogic), 67 new TransformationContent(data) 69 68 }; 70 69 -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/FilterView.cs
r15110 r15274 74 74 rBtnAnd.Enabled = (activeFilters > 0); 75 75 rBtnOr.Enabled = (activeFilters > 0); 76 Content.FilterLogic.Reset(); 77 bool[] result = Content.FilterLogic.Preview(filters, rBtnAnd.Checked); 76 Content.PreprocessingData.ResetFilter(); 77 bool isAndCombination = rBtnAnd.Checked; 78 bool[] ret; 79 IList<IFilter> activeFilters1 = filters.Where(f => f.Active && f.ConstraintData != null).ToList(); 80 if (activeFilters1.Count > 0) { 81 var result1 = Enumerable.Repeat(!isAndCombination, Content.PreprocessingData.Rows).ToArray(); 82 83 foreach (IFilter filter in activeFilters1) { 84 bool[] filterResult = filter.Check(); 85 for (int row = 0; row < result1.Length; ++row) { 86 result1[row] = isAndCombination ? result1[row] || filterResult[row] : result1[row] && filterResult[row]; 87 } 88 } 89 Content.PreprocessingData.SetFilter(result1); 90 ret = result1; 91 } else { 92 ret = Enumerable.Repeat(false, Content.PreprocessingData.Rows).ToArray(); 93 } 94 bool[] result = ret; 78 95 79 96 int filteredCnt = result.Count(c => !c); … … 89 106 List<IFilter> filters = Content.Filters.ToList(); 90 107 //apply filters 91 Content.FilterLogic.Apply(filters, rBtnAnd.Checked); 108 bool isAndCombination = rBtnAnd.Checked; 109 Content.PreprocessingData.PersistFilter(); 110 Content.PreprocessingData.ResetFilter(); 92 111 //deactivate checked filters 93 112 filters = checkedFilterView.Content.CheckedItems.ToList(); … … 104 123 if (Content != null) { 105 124 foreach (IFilter filter in e.Items) { 106 filter.ConstrainedValue = Content. FilterLogic.PreprocessingData;125 filter.ConstrainedValue = Content.PreprocessingData; 107 126 } 108 127 } -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/ManipulationView.cs
r15269 r15274 83 83 protected override void RegisterContentEvents() { 84 84 base.RegisterContentEvents(); 85 Content. FilterLogic.FilterChanged += FilterLogic_FilterChanged;85 Content.ManipulationLogic.PreProcessingData.FilterChanged += FilterLogic_FilterChanged; 86 86 } 87 87 88 88 protected override void DeregisterContentEvents() { 89 Content. FilterLogic.FilterChanged -= FilterLogic_FilterChanged;89 Content.ManipulationLogic.PreProcessingData.FilterChanged -= FilterLogic_FilterChanged; 90 90 base.DeregisterContentEvents(); 91 91 } … … 98 98 99 99 private void CheckFilters() { 100 if (Content. FilterLogic.IsFiltered) {100 if (Content.PreprocessingData.IsFiltered) { 101 101 tabsPreview.SelectedIndex = 0; 102 102 lstMethods.Enabled = false; … … 159 159 var filteredColumns = Content.ManipulationLogic.ColumnsWithMissingValuesGreater(GetDeleteColumnsInfo()); 160 160 int count = filteredColumns.Count; 161 int columnCount = Content. FilterLogic.PreprocessingData.Columns;161 int columnCount = Content.PreprocessingData.Columns; 162 162 lblPreviewColumnsInfo.Text = string.Format("{0} column{1} of {2} ({3}) were detected with more than {4}% missing values.", count, (count > 1 || count == 0 ? "s" : ""), columnCount, string.Format("{0:F2}%", 100d / columnCount * count), txtDeleteColumnsInfo.Text); 163 163 … … 190 190 var filteredColumns = Content.ManipulationLogic.ColumnsWithVarianceSmaller(GetDeleteColumnsVariance()); 191 191 int count = filteredColumns.Count; 192 int columnCount = Content. FilterLogic.PreprocessingData.Columns;192 int columnCount = Content.PreprocessingData.Columns; 193 193 lblPreviewColumnsVariance.Text = string.Format("{0} column{1} of {2} ({3}) were detected with a variance smaller than {4}.", count, (count > 1 || count == 0 ? "s" : ""), columnCount, string.Format("{0:F2}%", 100d / columnCount * count), txtDeleteColumnsVariance.Text); 194 194 … … 220 220 if (btnApply.Enabled) { 221 221 int count = Content.ManipulationLogic.RowsWithMissingValuesGreater(GetRowsColumnsInfo()).Count; 222 int rowCount = Content. FilterLogic.PreprocessingData.Rows;222 int rowCount = Content.PreprocessingData.Rows; 223 223 lblPreviewRowsInfo.Text = count + " row" + (count > 1 || count == 0 ? "s" : "") + " of " + rowCount + " (" + string.Format("{0:F2}%", 100d / rowCount * count) + ") were detected with more than " + txtDeleteRowsInfo.Text + "% missing values."; 224 224 if (count > 0) { … … 256 256 if (Content.ManipulationLogic.PreProcessingData.IsCellEmpty(columnIndex, rowIndex)) count++; 257 257 258 int cellCount = Content. FilterLogic.PreprocessingData.Rows * Content.FilterLogic.PreprocessingData.Columns;258 int cellCount = Content.PreprocessingData.Rows * Content.PreprocessingData.Columns; 259 259 lblPreviewReplaceMissingValues.Text = count + " cell" + (count > 1 || count == 0 ? "s" : "") 260 260 + " of " + cellCount + " (" + string.Format("{0:F2}%", 100d / cellCount * count) + ") were detected with missing values which would be replaced with " + replaceWith; -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/StatisticsView.cs
r15210 r15274 88 88 private void UpdateData(Dictionary<string, bool> oldVisibility = null) { 89 89 var logic = Content.StatisticsLogic; 90 rowsTextBox.Text = logic.GetRowCount().ToString(); 91 columnsTextBox.Text = logic.GetColumnCount().ToString(); 92 numericColumnsTextBox.Text = logic.GetNumericColumnCount().ToString(); 93 nominalColumnsTextBox5.Text = logic.GetNominalColumnCount().ToString(); 90 var data = Content.PreprocessingData; 91 rowsTextBox.Text = data.Rows.ToString(); 92 columnsTextBox.Text = data.Rows.ToString(); 93 numericColumnsTextBox.Text = GetColumnCount<double>().ToString(); 94 nominalColumnsTextBox5.Text = GetColumnCount<string>().ToString(); 94 95 missingValuesTextBox.Text = logic.GetMissingValueCount().ToString(); 95 totalValuesTextBox.Text = ( logic.GetColumnCount() * logic.GetRowCount()- logic.GetMissingValueCount()).ToString();96 totalValuesTextBox.Text = (data.Rows * data.Rows - logic.GetMissingValueCount()).ToString(); 96 97 97 98 var variableNames = Content.PreprocessingData.VariableNames.ToList(); … … 107 108 }; 108 109 109 for (int i = 0; i < logic.GetColumnCount(); i++) {110 var data= GetStatistics(i);111 for (int j = 0; j < data.Count; j++) {110 for (int i = 0; i < data.Columns; i++) { 111 var statistics = GetStatistics(i); 112 for (int j = 0; j < statistics.Count; j++) { 112 113 if (horizontal) 113 statisticsMatrix[j, i] = data[j];114 statisticsMatrix[j, i] = statistics[j]; 114 115 else 115 statisticsMatrix[i, j] = data[j];116 statisticsMatrix[i, j] = statistics[j]; 116 117 } 117 118 } … … 136 137 stringMatrixView.DataGridView.AutoResizeColumns(); 137 138 stringMatrixView.Parent.ResumeRepaint(true); 139 } 140 141 public int GetColumnCount<T>() { 142 int count = 0; 143 for (int i = 0; i < Content.PreprocessingData.Columns; ++i) { 144 if (Content.PreprocessingData.VariableHasType<T>(i)) { 145 ++count; 146 } 147 } 148 return count; 138 149 } 139 150 -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing.Views/3.4/TransformationView.cs
r15110 r15274 51 51 52 52 protected override void RegisterContentEvents() { 53 Content. FilterLogic.FilterChanged += FilterLogic_FilterChanged;53 Content.PreprocessingData.FilterChanged += FilterLogic_FilterChanged; 54 54 } 55 55 56 56 protected override void DeregisterContentEvents() { 57 Content. FilterLogic.FilterChanged -= FilterLogic_FilterChanged;57 Content.PreprocessingData.FilterChanged -= FilterLogic_FilterChanged; 58 58 } 59 59 … … 65 65 66 66 private void CheckFilters() { 67 if (Content. FilterLogic.IsFiltered) {67 if (Content.PreprocessingData.IsFiltered) { 68 68 applyButton.Enabled = false; 69 69 lblFilterNotice.Visible = true; … … 82 82 } 83 83 84 var transformator = new PreprocessingTransformator(Content. Data);84 var transformator = new PreprocessingTransformator(Content.PreprocessingData); 85 85 bool preserve = preserveColumnsCheckbox.CheckState == CheckState.Checked; 86 86 string errorMsg; -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/CorrelationMatrixContent.cs
r15270 r15274 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 using HeuristicLab.Problems.DataAnalysis; 26 27 27 28 namespace HeuristicLab.DataPreprocessing { 28 29 [Item("Feature Correlation Matrix", "Represents the feature correlation matrix.")] 29 public class CorrelationMatrixContent : Item, IViewShortcut { 30 [StorableClass] 31 public class CorrelationMatrixContent : PreprocessingContent, IViewShortcut { 30 32 public static new Image StaticItemImage { 31 33 get { return HeuristicLab.Common.Resources.VSImageLibrary.Gradient; } 32 34 } 33 35 36 [Storable] 34 37 public PreprocessingContext Context { get; private set; } 35 public IPreprocessingData PreprocessingData { 36 get { return Context.Data; } 37 } 38 38 39 39 40 public DataAnalysisProblemData ProblemData { … … 47 48 } 48 49 49 public CorrelationMatrixContent(PreprocessingContext context) { 50 #region Constructor, Cloning & Persistence 51 public CorrelationMatrixContent(PreprocessingContext context) 52 : base(context.Data) { 50 53 Context = context; 51 54 } … … 55 58 Context = original.Context; 56 59 } 57 58 60 public override IDeepCloneable Clone(Cloner cloner) { 59 61 return new CorrelationMatrixContent(this, cloner); 60 62 } 63 64 [StorableConstructor] 65 protected CorrelationMatrixContent(bool deserializing) 66 : base(deserializing) { } 67 #endregion 61 68 62 69 public event DataPreprocessingChangedEventHandler Changed { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/DataCompletenessChartContent.cs
r15270 r15274 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 26 27 namespace HeuristicLab.DataPreprocessing { 27 28 [Item("Data Completeness Chart", "Represents a datacompleteness chart.")] 28 29 public class DataCompletenessChartContent : Item, IViewShortcut {29 [StorableClass] 30 public class DataCompletenessChartContent : PreprocessingContent, IViewShortcut { 30 31 public static new Image StaticItemImage { 31 32 get { return HeuristicLab.Common.Resources.VSImageLibrary.EditBrightnessContrast; } 32 33 } 33 34 34 public IPreprocessingData PreprocessingData { get; private set; } 35 36 public DataCompletenessChartContent(IPreprocessingData preprocessingData) { 37 PreprocessingData = preprocessingData; 35 #region Constructor, Cloning & Persistence 36 public DataCompletenessChartContent(IFilteredPreprocessingData preprocessingData) 37 : base(preprocessingData) { 38 38 } 39 39 40 40 public DataCompletenessChartContent(DataCompletenessChartContent content, Cloner cloner) 41 41 : base(content, cloner) { 42 PreprocessingData = content.PreprocessingData;43 42 } 44 45 43 public override IDeepCloneable Clone(Cloner cloner) { 46 44 return new DataCompletenessChartContent(this, cloner); 47 45 } 46 47 [StorableConstructor] 48 protected DataCompletenessChartContent(bool deserializing) 49 : base(deserializing) { } 50 #endregion 48 51 } 49 52 } -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/DataGridContent.cs
r15270 r15274 27 27 using HeuristicLab.Core; 28 28 using HeuristicLab.Data; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 30 30 31 namespace HeuristicLab.DataPreprocessing { 31 32 32 [Item("Data Grid", "Represents a data grid.")] 33 public class DataGridContent : Item, IStringConvertibleMatrix, IViewShortcut { 33 [StorableClass] 34 public class DataGridContent : PreprocessingContent, IStringConvertibleMatrix, IViewShortcut { 34 35 public static new Image StaticItemImage { 35 36 get { return HeuristicLab.Common.Resources.VSImageLibrary.Table; } 36 37 } 37 38 38 public IPreprocessingData PreprocessingData { get; private set; } 39 39 [Storable] 40 40 public ManipulationLogic ManipulationLogic { get; private set; } 41 public FilterLogic FilterLogic { get; private set; }42 41 43 42 public int Rows { … … 75 74 } 76 75 77 public DataGridContent(IPreprocessingData preprocessingData, ManipulationLogic theManipulationLogic, FilterLogic theFilterLogic) {78 ManipulationLogic = theManipulationLogic;79 FilterLogic = theFilterLogic;80 PreprocessingData = preprocessingData;76 #region Constructor, Cloning & Persistence 77 public DataGridContent(IFilteredPreprocessingData preprocessingData, ManipulationLogic manipulationLogic) 78 : base(preprocessingData) { 79 ManipulationLogic = manipulationLogic; 81 80 } 82 81 83 public DataGridContent(DataGridContent dataGridContent, Cloner cloner)84 : base( dataGridContent, cloner) {85 82 public DataGridContent(DataGridContent original, Cloner cloner) 83 : base(original, cloner) { 84 ManipulationLogic = cloner.Clone(original.ManipulationLogic); 86 85 } 87 86 public override IDeepCloneable Clone(Cloner cloner) { 88 87 return new DataGridContent(this, cloner); 89 88 } 89 90 [StorableConstructor] 91 protected DataGridContent(bool deserializing) 92 : base(deserializing) { } 93 #endregion 90 94 91 95 public void DeleteRows(IEnumerable<int> rows) { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/FilterContent.cs
r15110 r15274 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.DataPreprocessing.Filter; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 27 27 28 namespace HeuristicLab.DataPreprocessing { 28 29 [Item("Filter", "Represents the filter grid.")] 29 public class FilterContent : Item, IViewShortcut { 30 [StorableClass] 31 public class FilterContent : PreprocessingContent, IViewShortcut { 30 32 public static new Image StaticItemImage { 31 33 get { return HeuristicLab.Common.Resources.VSImageLibrary.Filter; } 32 34 } 33 34 public FilterLogic FilterLogic { get; private set; } 35 35 [Storable] 36 36 public ICheckedItemCollection<IFilter> Filters { get; private set; } 37 37 38 [Storable] 38 39 public bool IsAndCombination { get; set; } 39 40 40 public FilterContent(FilterLogic filterLogic) { 41 #region Constructor, Cloning & Persistence 42 public FilterContent(IFilteredPreprocessingData preprocessingData) 43 : base(preprocessingData) { 41 44 Filters = new CheckedItemCollection<IFilter>(); 42 45 IsAndCombination = true; 43 FilterLogic = filterLogic;44 46 } 45 47 46 protected FilterContent(FilterContent content, Cloner cloner) 47 : base(content, cloner) { 48 protected FilterContent(FilterContent original, Cloner cloner) 49 : base(original, cloner) { 50 Filters = cloner.Clone(original.Filters); 51 IsAndCombination = original.IsAndCombination; 48 52 } 49 50 53 public override IDeepCloneable Clone(Cloner cloner) { 51 54 return new FilterContent(this, cloner); 52 55 } 56 57 [StorableConstructor] 58 protected FilterContent(bool deserializing) 59 : base(deserializing) { } 60 #endregion 53 61 } 54 62 } -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/HistogramContent.cs
r15210 r15274 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 29 29 30 namespace HeuristicLab.DataPreprocessing { 30 31 [Item("Histogram", "Represents the histogram grid.")] 32 [StorableClass] 31 33 public class HistogramContent : PreprocessingChartContent { 32 34 public static new Image StaticItemImage { … … 34 36 } 35 37 38 [Storable] 36 39 public string GroupingVariableName { get; set; } 37 40 41 [Storable] 38 42 public int Bins { get; set; } 43 [Storable] 39 44 public bool ExactBins { get; set; } 40 45 46 [Storable] 41 47 public LegendOrder Order { get; set; } 42 48 49 #region Constructor, Cloning & Persistence 43 50 public HistogramContent(IFilteredPreprocessingData preprocessingData) 44 51 : base(preprocessingData) { … … 47 54 } 48 55 49 public HistogramContent(HistogramContent content, Cloner cloner) 50 : base(content, cloner) { 56 public HistogramContent(HistogramContent original, Cloner cloner) 57 : base(original, cloner) { 58 GroupingVariableName = original.GroupingVariableName; 59 Bins = original.Bins; 60 ExactBins = original.ExactBins; 61 Order = original.Order; 51 62 } 52 63 public override IDeepCloneable Clone(Cloner cloner) { 53 64 return new HistogramContent(this, cloner); 54 65 } 66 67 [StorableConstructor] 68 protected HistogramContent(bool deserializing) 69 : base(deserializing) { } 70 #endregion 55 71 56 72 public static DataTable CreateHistogram(IFilteredPreprocessingData preprocessingData, string variableName, string groupingVariableName, DataTableVisualProperties.DataTableHistogramAggregation aggregation, LegendOrder legendOrder = LegendOrder.Alphabetically) { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/LineChartContent.cs
r15110 r15274 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 26 27 namespace HeuristicLab.DataPreprocessing { 27 28 28 [Item("Line Chart", "Represents the line chart grid.")] 29 [StorableClass] 29 30 public class LineChartContent : PreprocessingChartContent { 30 public bool AllInOneMode { get; set; }31 32 31 public static new Image StaticItemImage { 33 32 get { return HeuristicLab.Common.Resources.VSImageLibrary.Performance; } 34 33 } 35 34 35 [Storable] 36 public bool AllInOneMode { get; set; } 37 38 39 #region Constructor, Cloning & Persistence 36 40 public LineChartContent(IFilteredPreprocessingData preprocessingData) 37 41 : base(preprocessingData) { … … 39 43 } 40 44 41 public LineChartContent(LineChartContent content, Cloner cloner)42 : base( content, cloner) {43 this.AllInOneMode = content.AllInOneMode;45 public LineChartContent(LineChartContent original, Cloner cloner) 46 : base(original, cloner) { 47 AllInOneMode = original.AllInOneMode; 44 48 } 45 49 public override IDeepCloneable Clone(Cloner cloner) { 46 50 return new LineChartContent(this, cloner); 47 51 } 52 53 [StorableConstructor] 54 protected LineChartContent(bool deserializing) 55 : base(deserializing) { } 56 #endregion 48 57 } 49 58 } -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/ManipulationContent.cs
r15269 r15274 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 26 27 namespace HeuristicLab.DataPreprocessing { 27 28 28 [Item("Manipulation", "Represents the available manipulations on a data set.")] 29 public class ManipulationContent : Item, IViewShortcut { 29 [StorableClass] 30 public class ManipulationContent : PreprocessingContent, IViewShortcut { 30 31 public static new Image StaticItemImage { 31 32 get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; } 32 33 } 33 34 35 [Storable] 34 36 public ManipulationLogic ManipulationLogic { get; private set; } 35 public FilterLogic FilterLogic { get; private set; }36 37 37 public ManipulationContent(ManipulationLogic manipulationLogic, FilterLogic filterLogic) { 38 #region Constructor, Cloning & Persistence 39 public ManipulationContent(IFilteredPreprocessingData preprocessingData, ManipulationLogic manipulationLogic) 40 : base(preprocessingData) { 38 41 ManipulationLogic = manipulationLogic; 39 FilterLogic = filterLogic;40 42 } 41 43 42 public ManipulationContent(ManipulationContent content, Cloner cloner) : base(content, cloner) { } 43 44 public ManipulationContent(ManipulationContent original, Cloner cloner) : 45 base(original, cloner) { 46 ManipulationLogic = cloner.Clone(original.ManipulationLogic); 47 } 44 48 public override IDeepCloneable Clone(Cloner cloner) { 45 49 return new ManipulationContent(this, cloner); 46 50 } 51 52 [StorableConstructor] 53 protected ManipulationContent(bool deserializing) 54 : base(deserializing) { } 55 #endregion 47 56 } 48 57 } -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/MultiScatterPlotContent.cs
r15110 r15274 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 26 27 namespace HeuristicLab.DataPreprocessing { 27 28 28 [Item("Multi Scatter Plot", "Represents a multi scatter plot.")] 29 [StorableClass] 29 30 public class MultiScatterPlotContent : ScatterPlotContent { 30 31 public static new Image StaticItemImage { … … 32 33 } 33 34 35 #region Constructor, Cloning & Persistence 34 36 public MultiScatterPlotContent(IFilteredPreprocessingData preprocessingData) 35 37 : base(preprocessingData) { 36 38 } 37 39 38 public MultiScatterPlotContent(MultiScatterPlotContent content, Cloner cloner)39 : base( content, cloner) {40 public MultiScatterPlotContent(MultiScatterPlotContent original, Cloner cloner) 41 : base(original, cloner) { 40 42 } 41 42 43 public override IDeepCloneable Clone(Cloner cloner) { 43 44 return new MultiScatterPlotContent(this, cloner); 44 45 } 46 47 [StorableConstructor] 48 protected MultiScatterPlotContent(bool deserializing) 49 : base(deserializing) { } 50 #endregion 45 51 } 46 52 } -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs
r15210 r15274 29 29 using HeuristicLab.Core; 30 30 using HeuristicLab.Data; 31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 32 32 33 namespace HeuristicLab.DataPreprocessing { 33 34 [Item("PreprocessingChart", "Represents a preprocessing chart.")] 34 public class PreprocessingChartContent : Item, IViewShortcut { 35 [StorableClass] 36 public class PreprocessingChartContent : PreprocessingContent, IViewShortcut { 35 37 public enum LegendOrder { 36 38 Alphabetically, … … 42 44 } 43 45 44 private ICheckedItemList<StringValue> variableItemList = null; 46 [Storable] 47 private ICheckedItemList<StringValue> variableItemList; 45 48 public ICheckedItemList<StringValue> VariableItemList { 46 49 get { 47 50 if (variableItemList == null) 48 51 variableItemList = CreateVariableItemList(PreprocessingData); 49 return this.variableItemList;52 return variableItemList; 50 53 } 51 54 } 52 55 53 public IFilteredPreprocessingData PreprocessingData { get; private set; }54 56 public event DataPreprocessingChangedEventHandler Changed { 55 57 add { PreprocessingData.Changed += value; } … … 57 59 } 58 60 59 public PreprocessingChartContent(IFilteredPreprocessingData preprocessingData) { 60 PreprocessingData = preprocessingData; 61 #region Constructor, Cloning & Persistence 62 public PreprocessingChartContent(IFilteredPreprocessingData preprocessingData) 63 : base(preprocessingData) { 61 64 } 62 65 63 public PreprocessingChartContent(PreprocessingChartContent content, Cloner cloner) 64 : base(content, cloner) { 65 this.PreprocessingData = content.PreprocessingData; 66 this.variableItemList = cloner.Clone<ICheckedItemList<StringValue>>(variableItemList); 66 public PreprocessingChartContent(PreprocessingChartContent original, Cloner cloner) 67 : base(original, cloner) { 68 variableItemList = cloner.Clone(original.variableItemList); 67 69 } 68 70 public override IDeepCloneable Clone(Cloner cloner) { 69 71 return new PreprocessingChartContent(this, cloner); 70 72 } 73 74 [StorableConstructor] 75 protected PreprocessingChartContent(bool deserializing) 76 : base(deserializing) { } 77 #endregion 71 78 72 79 public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/ScatterPlotContent.cs
r15210 r15274 25 25 using HeuristicLab.Analysis; 26 26 using HeuristicLab.Common; 27 using HeuristicLab.Core; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 29 using HeuristicLab.Visualization.ChartControlsExtensions; 28 30 29 31 namespace HeuristicLab.DataPreprocessing { 30 32 [Item("ScatterPlotContent", "")] 33 [StorableClass] 31 34 public abstract class ScatterPlotContent : PreprocessingChartContent { 35 [Storable] 32 36 public string GroupingVariable { get; set; } 33 37 38 #region Constructor, Cloning & Persistence 34 39 protected ScatterPlotContent(IFilteredPreprocessingData preprocessingData) 35 40 : base(preprocessingData) { 36 41 } 37 42 38 protected ScatterPlotContent(ScatterPlotContent content, Cloner cloner) 39 : base(content, cloner) { 43 protected ScatterPlotContent(ScatterPlotContent original, Cloner cloner) 44 : base(original, cloner) { 45 GroupingVariable = original.GroupingVariable; 40 46 } 47 48 [StorableConstructor] 49 protected ScatterPlotContent(bool deserializing) 50 : base(deserializing) { } 51 #endregion 41 52 42 53 public static ScatterPlot CreateScatterPlot(IFilteredPreprocessingData preprocessingData, string variableNameX, string variableNameY, string variableNameGroup = "-", LegendOrder legendOrder = LegendOrder.Alphabetically) { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/SingleScatterPlotContent.cs
r15110 r15274 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 26 27 namespace HeuristicLab.DataPreprocessing { 27 28 28 [Item("Scatter Plot", "Represents a scatter plot.")] 29 [StorableClass] 29 30 public class SingleScatterPlotContent : ScatterPlotContent { 30 31 public static new Image StaticItemImage { … … 32 33 } 33 34 35 [Storable] 34 36 public string SelectedXVariable { get; set; } 37 [Storable] 35 38 public string SelectedYVariable { get; set; } 36 39 40 #region Constructor, Cloning & Persistence 37 41 public SingleScatterPlotContent(IFilteredPreprocessingData preprocessingData) 38 42 : base(preprocessingData) { 39 43 } 40 44 41 public SingleScatterPlotContent(SingleScatterPlotContent content, Cloner cloner) 42 : base(content, cloner) { 43 this.SelectedXVariable = content.SelectedXVariable; 44 this.SelectedYVariable = content.SelectedYVariable; 45 this.GroupingVariable = content.GroupingVariable; 45 public SingleScatterPlotContent(SingleScatterPlotContent original, Cloner cloner) 46 : base(original, cloner) { 47 SelectedXVariable = original.SelectedXVariable; 48 SelectedYVariable = original.SelectedYVariable; 46 49 } 47 48 50 public override IDeepCloneable Clone(Cloner cloner) { 49 51 return new SingleScatterPlotContent(this, cloner); 50 52 } 53 54 [StorableConstructor] 55 protected SingleScatterPlotContent(bool deserializing) 56 : base(deserializing) { } 57 #endregion 51 58 } 52 59 } -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/StatisticsContent.cs
r15270 r15274 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 26 27 namespace HeuristicLab.DataPreprocessing { 27 28 [Item("Statistics", "Represents the statistics grid.")] 28 public class StatisticsContent : Item, IViewShortcut { 29 [StorableClass] 30 public class StatisticsContent : PreprocessingContent, IViewShortcut { 29 31 public static new Image StaticItemImage { 30 32 get { return HeuristicLab.Common.Resources.VSImageLibrary.Object; } 31 33 } 32 34 33 public IPreprocessingData PreprocessingData { get; private set; }35 [Storable] 34 36 public StatisticsLogic StatisticsLogic { get; private set; } 35 37 36 public StatisticsContent(IPreprocessingData preProcessingData, StatisticsLogic statisticsLogic) { 37 PreprocessingData = preProcessingData; 38 #region Constructor, Cloning & Persistence 39 public StatisticsContent(IFilteredPreprocessingData preprocessingData, StatisticsLogic statisticsLogic) 40 : base(preprocessingData) { 38 41 StatisticsLogic = statisticsLogic; 39 42 } 40 43 41 public StatisticsContent(StatisticsContent content, Cloner cloner) 42 : base(content, cloner) { 44 public StatisticsContent(StatisticsContent original, Cloner cloner) 45 : base(original, cloner) { 46 StatisticsLogic = cloner.Clone(original.StatisticsLogic); 43 47 } 44 45 48 public override IDeepCloneable Clone(Cloner cloner) { 46 49 return new StatisticsContent(this, cloner); 47 50 } 51 52 [StorableConstructor] 53 protected StatisticsContent(bool deserializing) 54 : base(deserializing) { } 55 #endregion 48 56 49 57 public event DataPreprocessingChangedEventHandler Changed { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Content/TransformationContent.cs
r15110 r15274 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 26 using HeuristicLab.Problems.DataAnalysis; 26 27 27 28 namespace HeuristicLab.DataPreprocessing { 28 29 [Item("Transformation", "Represents the transformation grid.")] 29 public class TransformationContent : Item, IViewShortcut { 30 [StorableClass] 31 public class TransformationContent : PreprocessingContent, IViewShortcut { 30 32 public static new Image StaticItemImage { 31 33 get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; } 32 34 } 33 35 34 public IPreprocessingData Data { get; private set; } 35 public FilterLogic FilterLogic { get; private set; } 36 36 [Storable] 37 37 public ICheckedItemList<ITransformation> CheckedTransformationList { get; private set; } 38 38 39 public TransformationContent(IPreprocessingData data, FilterLogic filterLogic) { 40 Data = data; 39 #region Constructor, Cloning & Persistence 40 public TransformationContent(IFilteredPreprocessingData preprocessingData) 41 : base(preprocessingData) { 41 42 CheckedTransformationList = new CheckedItemList<ITransformation>(); 42 FilterLogic = filterLogic;43 43 } 44 44 45 45 public TransformationContent(TransformationContent original, Cloner cloner) 46 46 : base(original, cloner) { 47 Data = original.Data; 48 CheckedTransformationList = new CheckedItemList<ITransformation>(original.CheckedTransformationList); 47 CheckedTransformationList = cloner.Clone(original.CheckedTransformationList); 49 48 } 50 51 49 public override IDeepCloneable Clone(Cloner cloner) { 52 50 return new TransformationContent(this, cloner); 53 51 } 52 53 [StorableConstructor] 54 protected TransformationContent(bool deserializing) 55 : base(deserializing) { } 56 #endregion 54 57 } 55 58 } -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/FilteredPreprocessingData.cs
r15270 r15274 42 42 } 43 43 44 #region Constructor, Cloning & Persist ance44 #region Constructor, Cloning & Persistence 45 45 public FilteredPreprocessingData(IPreprocessingData preporcessingData) 46 46 : base() { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Data/PreprocessingData.cs
r15270 r15274 42 42 protected IList<string> variableNames; 43 43 44 #region Constructor, Cloning & Persist ance44 #region Constructor, Cloning & Persistence 45 45 public PreprocessingData(IDataAnalysisProblemData problemData) 46 46 : base() { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/HeuristicLab.DataPreprocessing-3.4.csproj
r15270 r15274 119 119 <ItemGroup> 120 120 <Compile Include="Content\MultiScatterPlotContent.cs" /> 121 <Compile Include="Content\PreprocessingContent.cs" /> 121 122 <Compile Include="Content\SingleScatterPlotContent.cs" /> 122 123 <Compile Include="Content\ScatterPlotContent.cs" /> … … 135 136 <Compile Include="Data\IPreprocessingData.cs" /> 136 137 <Compile Include="Content\FilterContent.cs" /> 137 <Compile Include="Logic\FilterLogic.cs" />138 138 <Compile Include="Content\HistogramContent.cs" /> 139 139 <Compile Include="Content\LineChartContent.cs" /> -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Logic/ManipulationLogic.cs
r15270 r15274 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 25 27 using HeuristicLab.Data; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 29 using HeuristicLab.Random; 27 30 28 31 namespace HeuristicLab.DataPreprocessing { 29 public class ManipulationLogic { 30 private readonly IPreprocessingData preprocessingData; 32 [Item("ManipulationLogic", "")] 33 [StorableClass] 34 public class ManipulationLogic : Item { 35 36 [Storable] 37 private readonly IFilteredPreprocessingData preprocessingData; 38 39 [Storable] 31 40 private readonly StatisticsLogic statisticsLogic; 32 41 … … 35 44 } 36 45 37 public I PreprocessingData PreProcessingData {46 public IFilteredPreprocessingData PreProcessingData { 38 47 get { return preprocessingData; } 39 48 } 40 49 41 public ManipulationLogic(IPreprocessingData preprocessingData, StatisticsLogic theStatisticsLogic) { 50 #region Constructor, Cloning & Persistence 51 public ManipulationLogic(IFilteredPreprocessingData preprocessingData, StatisticsLogic theStatisticsLogic) { 42 52 this.preprocessingData = preprocessingData; 43 53 statisticsLogic = theStatisticsLogic; 44 54 } 55 public ManipulationLogic(ManipulationLogic original, Cloner cloner) 56 : base(original, cloner) { 57 preprocessingData = cloner.Clone(original.preprocessingData); 58 statisticsLogic = cloner.Clone(original.statisticsLogic); 59 } 60 public override IDeepCloneable Clone(Cloner cloner) { 61 return new ManipulationLogic(this, cloner); 62 } 63 64 [StorableConstructor] 65 protected ManipulationLogic(bool deserializing) 66 : base(deserializing) { } 67 #endregion 45 68 46 69 public void ReplaceIndicesByValue<T>(int columnIndex, IEnumerable<int> rowIndices, T value) { … … 123 146 for (int i = 0; i < count; ++i) { 124 147 if (start == int.MinValue) { 125 start = indexOfPrevPresentValue(column.Key, rowIndices[i]);148 start = IndexOfPrevPresentValue(column.Key, rowIndices[i]); 126 149 } 127 150 if (i + 1 == count || (i + 1 < count && rowIndices[i + 1] - rowIndices[i] > 1)) { 128 int next = indexOfNextPresentValue(column.Key, rowIndices[i]);151 int next = IndexOfNextPresentValue(column.Key, rowIndices[i]); 129 152 if (start > 0 && next < preprocessingData.Rows) { 130 153 startEndings.Add(new Tuple<int, int>(start, next)); … … 144 167 // dont replace first or last values 145 168 if (index > 0 && index < countValues) { 146 int prevIndex = indexOfPrevPresentValue(column.Key, index);147 int nextIndex = indexOfNextPresentValue(column.Key, index);169 int prevIndex = IndexOfPrevPresentValue(column.Key, index); 170 int nextIndex = IndexOfNextPresentValue(column.Key, index); 148 171 149 172 // no neighbours found … … 183 206 } 184 207 185 private int indexOfPrevPresentValue(int columnIndex, int start) {208 private int IndexOfPrevPresentValue(int columnIndex, int start) { 186 209 int offset = start - 1; 187 210 while (offset >= 0 && preprocessingData.IsCellEmpty(columnIndex, offset)) { … … 192 215 } 193 216 194 private int indexOfNextPresentValue(int columnIndex, int start) {217 private int IndexOfNextPresentValue(int columnIndex, int start) { 195 218 int offset = start + 1; 196 219 while (offset < preprocessingData.Rows && preprocessingData.IsCellEmpty(columnIndex, offset)) { -
branches/DataPreprocessing Cleanup/HeuristicLab.DataPreprocessing/3.4/Logic/StatisticsLogic.cs
r15270 r15274 24 24 using System.Linq; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 28 27 29 namespace HeuristicLab.DataPreprocessing { 28 public class StatisticsLogic { 30 [Item("StatisticsLogic", "")] 31 [StorableClass] 32 public class StatisticsLogic : Item { 33 [Storable] 29 34 private readonly IPreprocessingData preprocessingData; 30 35 36 #region Constructor, Cloning & Persistence 31 37 public StatisticsLogic(IPreprocessingData preprocessingData) { 32 38 this.preprocessingData = preprocessingData; 33 39 } 34 35 public int GetColumnCount() { 36 return preprocessingData.Columns; 37 } 38 39 public int GetRowCount() { 40 return preprocessingData.Rows; 41 } 42 43 public int GetNumericColumnCount() { 44 int count = 0; 45 46 for (int i = 0; i < preprocessingData.Columns; ++i) { 47 if (preprocessingData.VariableHasType<double>(i)) { 48 ++count; 49 } 50 } 51 return count; 52 } 53 54 public int GetNominalColumnCount() { 55 return preprocessingData.Columns - GetNumericColumnCount(); 56 } 40 public StatisticsLogic(StatisticsLogic original, Cloner cloner) 41 : base(original, cloner) { 42 preprocessingData = cloner.Clone(original.preprocessingData); 43 } 44 public override IDeepCloneable Clone(Cloner cloner) { 45 return new StatisticsLogic(this, cloner); 46 } 47 48 [StorableConstructor] 49 protected StatisticsLogic(bool deserializing) 50 : base(deserializing) { } 51 #endregion 57 52 58 53 public int GetMissingValueCount() {
Note: See TracChangeset
for help on using the changeset viewer.