- Timestamp:
- 01/12/16 17:05:37 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/CorrelationMatrixContent.cs
r12012 r13502 21 21 22 22 using System.Drawing; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 32 33 } 33 34 34 private IPreprocessingContext Context { get; set; }35 private PreprocessingContext Context { get; set; } 35 36 private ITransactionalPreprocessingData PreprocessingData { 36 37 get { return Context.Data; } … … 39 40 public DataAnalysisProblemData ProblemData { 40 41 get { 41 var creator = new ProblemDataCreator(Context); 42 return (DataAnalysisProblemData)creator.CreateProblemData(); 42 // ToDo: avoid iterating 43 return Context.ExportPossibilities.Select(p => p.Value()).OfType<DataAnalysisProblemData>().Single(); 44 //var creator = new ProblemDataCreator(Context); 45 //return (DataAnalysisProblemData)creator.CreateProblemData(); 43 46 } 44 47 } 45 48 46 public CorrelationMatrixContent( IPreprocessingContext context) {49 public CorrelationMatrixContent(PreprocessingContext context) { 47 50 Context = context; 48 51 } … … 50 53 public CorrelationMatrixContent(CorrelationMatrixContent original, Cloner cloner) 51 54 : base(original, cloner) { 52 55 Context = original.Context; 53 56 } 54 57 -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/Filter/IFilter.cs
r10667 r13502 1 using HeuristicLab.Core; 2 using System; 3 using System.Collections.Generic; 4 using System.Linq; 5 using System.Text; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 6 21 7 namespace HeuristicLab.DataPreprocessing.Filter 8 { 9 public interface IFilter : IConstraint 10 {22 using HeuristicLab.Core; 23 24 namespace HeuristicLab.DataPreprocessing.Filter { 25 public interface IFilter : IConstraint { 11 26 new bool[] Check(); 12 27 new bool[] Check(out string errorMessage); -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/FilterLogic.cs
r12012 r13502 24 24 using System.Linq; 25 25 using HeuristicLab.DataPreprocessing.Filter; 26 using HeuristicLab.DataPreprocessing.Interfaces; 26 27 27 namespace HeuristicLab.DataPreprocessing { 28 28 public class FilterLogic : IFilterLogic { -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/FilteredPreprocessingData.cs
r13252 r13502 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 using HeuristicLab.Common; 4 25 using HeuristicLab.Core; 5 26 using HeuristicLab.Data; 6 using HeuristicLab.DataPreprocessing.Interfaces;7 27 using HeuristicLab.Problems.DataAnalysis; 8 28 9 namespace HeuristicLab.DataPreprocessing .Implementations{29 namespace HeuristicLab.DataPreprocessing { 10 30 public class FilteredPreprocessingData : NamedItem, IFilteredPreprocessingData { 11 31 private readonly ITransactionalPreprocessingData originalData; -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/HistogramContent.cs
r12676 r13502 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.DataPreprocessing.Interfaces;28 27 29 28 namespace HeuristicLab.DataPreprocessing { -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/LineChartContent.cs
r12012 r13502 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.DataPreprocessing.Interfaces;26 25 27 26 namespace HeuristicLab.DataPreprocessing { -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingChartContent.cs
r12676 r13502 28 28 using HeuristicLab.Core; 29 29 using HeuristicLab.Data; 30 using HeuristicLab.DataPreprocessing.Interfaces;31 30 32 31 namespace HeuristicLab.DataPreprocessing { -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingData.cs
r13427 r13502 94 94 selection = new Dictionary<int, IList<int>>(); 95 95 96 Import(problemData); 97 98 RegisterEventHandler(); 99 } 100 101 public void Import(IDataAnalysisProblemData problemData) { 96 102 Dataset dataset = (Dataset)problemData.Dataset; 97 103 variableNames = new List<string>(problemData.Dataset.VariableNames); … … 114 120 TrainingPartition = new IntRange(problemData.TrainingPartition.Start, problemData.TrainingPartition.End); 115 121 TestPartition = new IntRange(problemData.TestPartition.Start, problemData.TestPartition.End); 116 117 RegisterEventHandler();118 122 } 119 123 -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingDataTable.cs
r11114 r13502 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using HeuristicLab.Analysis; 3 24 using HeuristicLab.Common; 4 25 using HeuristicLab.Core; 5 26 6 namespace HeuristicLab.DataPreprocessing .Implementations{27 namespace HeuristicLab.DataPreprocessing { 7 28 [Item("PreprossingDataTable", "A table of data values.")] 8 29 public class PreprocessingDataTable : DataTable { -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/ScatterPlotContent.cs
r12012 r13502 22 22 using System.Collections.Generic; 23 23 using System.Drawing; 24 using System.Linq; 24 25 using HeuristicLab.Analysis; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HeuristicLab.DataPreprocessing.Interfaces;28 28 29 29 namespace HeuristicLab.DataPreprocessing { … … 34 34 public string SelectedXVariable { get; set; } 35 35 public string SelectedYVariable { get; set; } 36 public string SelectedColorVariable { get; set; } 36 37 37 38 public ScatterPlotContent(IFilteredPreprocessingData preprocessingData) … … 43 44 this.SelectedXVariable = content.SelectedXVariable; 44 45 this.SelectedYVariable = content.SelectedYVariable; 46 this.SelectedColorVariable = content.SelectedColorVariable; 45 47 } 46 48 47 public static new Image StaticItemImage 48 { 49 public static new Image StaticItemImage { 49 50 get { return HeuristicLab.Common.Resources.VSImageLibrary.Performance; } 50 51 } … … 54 55 } 55 56 56 public ScatterPlot CreateScatterPlot(string variableNameX, string variableNameY ) {57 public ScatterPlot CreateScatterPlot(string variableNameX, string variableNameY, string variableNameColor = "-") { 57 58 ScatterPlot scatterPlot = new ScatterPlot(); 58 59 59 60 IList<double> xValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameX)); 60 61 IList<double> yValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameY)); 62 if (variableNameColor == null || variableNameColor == "-") { 63 List<Point2D<double>> points = new List<Point2D<double>>(); 61 64 62 List<Point2D<double>> points = new List<Point2D<double>>(); 65 for (int i = 0; i < xValues.Count; i++) { 66 Point2D<double> point = new Point2D<double>(xValues[i], yValues[i]); 67 points.Add(point); 68 } 63 69 64 for (int i = 0; i < xValues.Count; i++) { 65 Point2D<double> point = new Point2D<double>(xValues[i], yValues[i]); 66 points.Add(point); 70 ScatterPlotDataRow scdr = new ScatterPlotDataRow(variableNameX + " - " + variableNameY, "", points); 71 scatterPlot.Rows.Add(scdr); 72 73 } else { 74 var colorValues = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableNameColor)); 75 var data = xValues.Zip(yValues, (x, y) => new { x, y }).Zip(colorValues, (v, c) => new { v.x, v.y, c }).ToList(); 76 var gradients = ColorGradient.Colors; 77 int curGradient = 0; 78 int numColors = colorValues.Distinct().Count(); 79 foreach (var colorValue in colorValues.Distinct()) { 80 var values = data.Where(x => x.c == colorValue); 81 var row = new ScatterPlotDataRow( 82 variableNameX + " - " + variableNameY + " (" + colorValue + ")", 83 "", 84 values.Select(v => new Point2D<double>(v.x, v.y)), 85 new ScatterPlotDataRowVisualProperties() { Color = gradients[curGradient] }); 86 curGradient += gradients.Count / numColors; 87 scatterPlot.Rows.Add(row); 88 } 67 89 } 68 69 ScatterPlotDataRow scdr = new ScatterPlotDataRow(variableNameX + " - " + variableNameY, "", points);70 scatterPlot.Rows.Add(scdr);71 90 return scatterPlot; 72 91 } -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/StatisticsContent.cs
r12012 r13502 19 19 */ 20 20 #endregion 21 21 22 using System.Drawing; 22 23 using HeuristicLab.Common; -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/StatisticsLogic.cs
r13051 r13502 26 26 27 27 namespace HeuristicLab.DataPreprocessing { 28 29 28 public class StatisticsLogic : IStatisticsLogic { 30 29
Note: See TracChangeset
for help on using the changeset viewer.