- Timestamp:
- 07/14/17 10:29:51 (7 years ago)
- Location:
- stable
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 15110,15119,15210
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing merged eligible /branches/crossvalidation-2434/HeuristicLab.DataPreprocessing merged eligible /trunk/sources/HeuristicLab.DataPreprocessing merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.DataPreprocessing 10321-10322 /branches/Algorithms.GradientDescent/HeuristicLab.DataPreprocessing 5516-5520 /branches/Benchmarking/sources/HeuristicLab.DataPreprocessing 6917-7005 /branches/CloningRefactoring/HeuristicLab.DataPreprocessing 4656-4721 /branches/CodeEditor/HeuristicLab.DataPreprocessing 11700-11806 /branches/DataAnalysis Refactoring/HeuristicLab.DataPreprocessing 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.DataPreprocessing 5815-6180 /branches/DataAnalysis/HeuristicLab.DataPreprocessing 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.DataPreprocessing 10085-11101 /branches/GP.Grammar.Editor/HeuristicLab.DataPreprocessing 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.DataPreprocessing 5060 /branches/HLScript/HeuristicLab.DataPreprocessing 10331-10358 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.DataPreprocessing 11570-12508 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.DataPreprocessing 6123-9799 /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.DataPreprocessing 11130-12721 /branches/HiveStatistics/sources/HeuristicLab.DataPreprocessing 12440-12877 /branches/LogResidualEvaluator/HeuristicLab.DataPreprocessing 10202-10483 /branches/NET40/sources/HeuristicLab.DataPreprocessing 5138-5162 /branches/NSGA-II Changes/HeuristicLab.DataPreprocessing 12033-12122 /branches/ParallelEngine/HeuristicLab.DataPreprocessing 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.DataPreprocessing 7568-7810 /branches/QAPAlgorithms/HeuristicLab.DataPreprocessing 6350-6627 /branches/Restructure trunk solution/HeuristicLab.DataPreprocessing 6828 /branches/RuntimeOptimizer/HeuristicLab.DataPreprocessing 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.DataPreprocessing 7787-8333 /branches/SlaveShutdown/HeuristicLab.DataPreprocessing 8944-8956 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.DataPreprocessing 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.DataPreprocessing 5370-5682 /branches/Trunk/HeuristicLab.DataPreprocessing 6829-6865 /branches/UnloadJobs/HeuristicLab.DataPreprocessing 9168-9215 /branches/VNS/HeuristicLab.DataPreprocessing 5594-5752 /branches/histogram/HeuristicLab.DataPreprocessing 5959-6341 /branches/symbreg-factors-2650/HeuristicLab.DataPreprocessing 14232-14825 /trunk/sources/HeuristicLab.Problems.TestFunctions.MultiObjective/HeuristicLab.DataPreprocessing 14175
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
stable/HeuristicLab.DataPreprocessing/3.4
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs
r14963 r15242 23 23 using System.Collections.Generic; 24 24 using System.Drawing; 25 using System.Linq; 25 26 using HeuristicLab.Analysis; 26 27 using HeuristicLab.Common; 28 using HeuristicLab.Common.Resources; 27 29 using HeuristicLab.Core; 28 30 using HeuristicLab.Data; … … 30 32 namespace HeuristicLab.DataPreprocessing { 31 33 [Item("PreprocessingChart", "Represents a preprocessing chart.")] 32 public class PreprocessingChartContent : Item, IViewChartShortcut { 33 public static new Image StaticItemImage { 34 get { return HeuristicLab.Common.Resources.VSImageLibrary.PieChart; } 34 public class PreprocessingChartContent : Item, IViewShortcut { 35 public enum LegendOrder { 36 Alphabetically, 37 Appearance 35 38 } 36 39 37 private bool allInOneMode = true; 38 public bool AllInOneMode { 39 get { return this.allInOneMode; } 40 set { this.allInOneMode = value; } 40 public static new Image StaticItemImage { 41 get { return VSImageLibrary.PieChart; } 41 42 } 42 43 43 44 private ICheckedItemList<StringValue> variableItemList = null; 44 45 public ICheckedItemList<StringValue> VariableItemList { 45 get { return this.variableItemList; } 46 set { this.variableItemList = value; } 46 get { 47 if (variableItemList == null) 48 variableItemList = CreateVariableItemList(PreprocessingData); 49 return this.variableItemList; 50 } 47 51 } 48 52 49 53 public IFilteredPreprocessingData PreprocessingData { get; private set; } 54 public event DataPreprocessingChangedEventHandler Changed { 55 add { PreprocessingData.Changed += value; } 56 remove { PreprocessingData.Changed -= value; } 57 } 50 58 51 59 public PreprocessingChartContent(IFilteredPreprocessingData preprocessingData) { … … 55 63 public PreprocessingChartContent(PreprocessingChartContent content, Cloner cloner) 56 64 : base(content, cloner) { 57 this.allInOneMode = content.allInOneMode;58 65 this.PreprocessingData = content.PreprocessingData; 59 66 this.variableItemList = cloner.Clone<ICheckedItemList<StringValue>>(variableItemList); … … 63 70 } 64 71 72 public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) { 73 return CreateDataRow(PreprocessingData, variableName, chartType); 74 } 65 75 66 public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) {67 IList<double> values = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableName));76 public static DataRow CreateDataRow(IFilteredPreprocessingData preprocessingData, string variableName, DataRowVisualProperties.DataRowChartType chartType) { 77 IList<double> values = preprocessingData.GetValues<double>(preprocessingData.GetColumnIndex(variableName)); 68 78 DataRow row = new DataRow(variableName, "", values); 69 79 row.VisualProperties.ChartType = chartType; … … 71 81 } 72 82 73 public List<DataRow> CreateAllDataRows(DataRowVisualProperties.DataRowChartType chartType) { 74 List<DataRow> dataRows = new List<DataRow>(); 75 foreach (var name in PreprocessingData.GetDoubleVariableNames()) 76 dataRows.Add(CreateDataRow(name, chartType)); 77 return dataRows; 78 } 79 80 public DataRow CreateSelectedDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) { 81 82 IDictionary<int, IList<int>> selection = PreprocessingData.Selection; 83 int variableIndex = PreprocessingData.GetColumnIndex(variableName); 84 85 if (selection.Keys.Contains(variableIndex)) { 86 List<int> selectedIndices = new List<int>(selection[variableIndex]); 87 //need selection with more than 1 value 88 if (selectedIndices.Count < 2) 89 return null; 90 91 selectedIndices.Sort(); 92 int start = selectedIndices[0]; 93 int end = selectedIndices[selectedIndices.Count - 1]; 94 95 DataRow rowSelect = CreateDataRowRange(variableName, start, end, chartType); 96 return rowSelect; 97 } else 98 return null; 99 } 100 101 public DataRow CreateDataRowRange(string variableName, int start, int end, DataRowVisualProperties.DataRowChartType chartType) { 102 IList<double> values = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableName)); 103 IList<double> valuesRange = new List<double>(); 104 for (int i = 0; i < values.Count; i++) { 105 if (i >= start && i <= end) 106 valuesRange.Add(values[i]); 107 else 108 valuesRange.Add(Double.NaN); 109 } 110 111 DataRow row = new DataRow(variableName, "", valuesRange); 112 row.VisualProperties.ChartType = chartType; 113 return row; 114 } 115 116 public List<DataRow> CreateAllSelectedDataRows(DataRowVisualProperties.DataRowChartType chartType) { 117 List<DataRow> dataRows = new List<DataRow>(); 118 foreach (var name in PreprocessingData.GetDoubleVariableNames()) { 119 DataRow row = CreateSelectedDataRow(name, chartType); 120 if (row != null) 121 dataRows.Add(row); 122 } 123 return dataRows; 124 } 125 126 127 public ICheckedItemList<StringValue> CreateVariableItemList(IList<string> checkedItems = null) { 128 if (checkedItems == null) checkedItems = new string[0]; 83 private static ICheckedItemList<StringValue> CreateVariableItemList(IPreprocessingData preprocessingData) { 129 84 ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>(); 130 foreach (string name in PreprocessingData.GetDoubleVariableNames()) {85 foreach (string name in preprocessingData.GetDoubleVariableNames()) { 131 86 var n = new StringValue(name); 132 itemList.Add(n, checkedItems.Contains(name)); 87 bool isInputTarget = preprocessingData.InputVariables.Contains(name) || preprocessingData.TargetVariable == name; 88 itemList.Add(n, isInputTarget); 133 89 } 134 90 return new ReadOnlyCheckedItemList<StringValue>(itemList); 135 91 } 136 92 137 public event DataPreprocessingChangedEventHandler Changed { 138 add { PreprocessingData.Changed += value; } 139 remove { PreprocessingData.Changed -= value; } 93 public static IEnumerable<string> GetVariableNamesForGrouping(IPreprocessingData preprocessingData, int maxDistinctValues = 20) { 94 var variableNames = new List<string>(); 95 96 for (int i = 0; i < preprocessingData.Columns; ++i) { 97 int distinctValues = Int32.MaxValue; 98 if (preprocessingData.VariableHasType<double>(i)) 99 distinctValues = preprocessingData.GetValues<double>(i).GroupBy(x => x).Count(); 100 else if (preprocessingData.VariableHasType<string>(i)) 101 distinctValues = preprocessingData.GetValues<string>(i).GroupBy(x => x).Count(); 102 else if (preprocessingData.VariableHasType<DateTime>(i)) 103 distinctValues = preprocessingData.GetValues<DateTime>(i).GroupBy(x => x).Count(); 104 105 if (distinctValues <= maxDistinctValues) 106 variableNames.Add(preprocessingData.GetVariableName(i)); 107 } 108 return variableNames; 140 109 } 141 142 110 } 143 111 }
Note: See TracChangeset
for help on using the changeset viewer.