Changeset 10221
- Timestamp:
- 12/11/13 17:21:25 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/DataPreprocessingView.cs
r10220 r10221 1 using System.Windows.Forms; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2013 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.Linq; 23 using System.Windows.Forms; 24 using HeuristicLab.Common; 25 using HeuristicLab.Core; 2 26 using HeuristicLab.Core.Views; 27 using HeuristicLab.Data; 3 28 using HeuristicLab.MainForm; 4 29 using HeuristicLab.MainForm.WindowsForms; 30 using HeuristicLab.Problems.DataAnalysis; 5 31 6 32 namespace HeuristicLab.DataPreprocessing { … … 36 62 MessageBox.Show("Success, now cloning... "); 37 63 64 Dataset dataset = Data.ExportToDataset(); 65 var variables = new CheckedItemList<StringValue>(Data.VariableNames.Select(s => new StringValue(s))).AsReadOnly(); 38 66 39 //Dataset ds = Data.ExportToDataset(); 40 //var cloner = new Cloner(); 67 var cloner = new Cloner(); 41 68 42 //cloner.RegisterClonedObject() 69 cloner.RegisterClonedObject(Content.DataAnalysisProblemData.Dataset, dataset); 70 cloner.RegisterClonedObject(Content.DataAnalysisProblemData.TrainingPartition, Data.TrainingPartition); 71 cloner.RegisterClonedObject(Content.DataAnalysisProblemData.TestPartition, Data.TestPartition); 72 cloner.RegisterClonedObject(Content.DataAnalysisProblemData.InputVariables, variables); 73 74 var item = cloner.Clone(Content.ParentItem); 75 76 MainFormManager.MainForm.ShowContent(item); 43 77 44 78 //var clone = null; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj
r10219 r10221 99 99 </ItemGroup> 100 100 <ItemGroup> 101 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 102 <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project> 103 <Name>HeuristicLab.Collections-3.3</Name> 104 </ProjectReference> 101 105 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 102 106 <Project>{0e27a536-1c4a-4624-a65e-dc4f4f23e3e1}</Project> -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingContext.cs
r10219 r10221 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Problems.DataAnalysis; 24 25 25 26 namespace HeuristicLab.DataPreprocessing { 26 27 [Item("PreprocessingContext", "PreprocessingContext")] 27 28 public class PreprocessingContext : Item, IPreprocessingContext { 28 public PreprocessingContext(IPreprocessingData data, IItem parentItem ) {29 public PreprocessingContext(IPreprocessingData data, IItem parentItem, IDataAnalysisProblemData dataAnalysisProblemData) { 29 30 Data = data; 30 31 ParentItem = parentItem; 32 DataAnalysisProblemData = dataAnalysisProblemData; 31 33 } 32 34 … … 35 37 Data = cloner.Clone(original.Data); 36 38 ParentItem = original.ParentItem; 39 DataAnalysisProblemData = original.DataAnalysisProblemData; 37 40 } 38 41 … … 44 47 public IItem ParentItem { get; private set; } 45 48 49 public IDataAnalysisProblemData DataAnalysisProblemData { get; private set; } 50 46 51 public override IDeepCloneable Clone(Cloner cloner) { 47 52 return new PreprocessingContext(this, cloner); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs
r10220 r10221 142 142 } 143 143 144 public IntRange TrainingPartition { 145 get { return new IntRange(0, (int)(Rows * trainingToTestRatio)); } 146 } 147 148 public IntRange TestPartition { 149 get { return new IntRange((int)(Rows * trainingToTestRatio), Math.Max(Rows - 1, 0)); } 150 } 151 144 152 public IEnumerable<string> VariableNames { 145 153 get { return variableNames; } … … 155 163 156 164 public int Rows { 157 get { return variableValues .Count; }165 get { return variableValues[variableNames[0]].Count; } 158 166 } 159 167 public IDictionary<string, IEnumerable<int>> GetMissingValueIndices() { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingContext.cs
r10219 r10221 21 21 22 22 using HeuristicLab.Core; 23 using HeuristicLab.Problems.DataAnalysis; 23 24 namespace HeuristicLab.DataPreprocessing { 24 25 public interface IPreprocessingContext : IItem { … … 29 30 /// </summary> 30 31 IItem ParentItem { get; } 32 33 IDataAnalysisProblemData DataAnalysisProblemData { get; } 31 34 } 32 35 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingData.cs
r10220 r10221 40 40 void DeleteColumn(string variableName); 41 41 42 IntRange TrainingPartition { get; } 43 IntRange TestPartition { get; } 44 42 45 IEnumerable<string> VariableNames { get; } 43 46 bool IsType<T>(string variableName); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Plugin.cs.frame
r10134 r10221 31 31 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] 32 32 [PluginDependency("HeuristicLab.Core", "3.3")] 33 [PluginDependency("HeuristicLab.Collections", "3.3")] 33 34 [PluginDependency("HeuristicLab.Persistence", "3.3")] 34 35 [PluginDependency("HeuristicLab.MainForm", "3.3")] -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Views/3.4/ProblemDataView.cs
r10219 r10221 30 30 using HeuristicLab.MainForm; 31 31 using HeuristicLab.MainForm.WindowsForms; 32 using HeuristicLab.Optimization.Views;33 32 34 33 namespace HeuristicLab.Problems.DataAnalysis.Views { … … 104 103 105 104 private void DataPreprocessingButton_Click(object sender, EventArgs e) { 106 IItem parentItem = Get AlgorithmOrProblem();105 IItem parentItem = GetMostOuterContent(); 107 106 var preprocessingData = new PreprocessingData(Content); 108 107 109 108 // TODO: ProblemDataView depends on DataPreprocessing 110 var context = new PreprocessingContext(preprocessingData, parentItem );109 var context = new PreprocessingContext(preprocessingData, parentItem, Content); 111 110 MainFormManager.MainForm.ShowContent(context); 112 113 //Type viewType = MainFormManager.GetViewTypes(this.Content.GetType(), true).FirstOrDefault(t => typeof(DataPreprocessingView).IsAssignableFrom(t));114 //MainFormManager.MainForm.ShowContent(Content, viewType);115 111 } 116 112 117 private IItem Get AlgorithmOrProblem() {118 Control a= this;119 I Item i= null;113 private IItem GetMostOuterContent() { 114 Control control = this; 115 ItemView itemView = null; 120 116 do { 121 a = a.Parent; 122 } while (a != null && !(a is ProblemView)); 117 control = control.Parent; 118 if (control is ItemView) 119 itemView = (ItemView)control; 120 } while (control != null); 123 121 124 if (a is ProblemView) { 125 i = ((ProblemView)a).Content; 126 } 127 128 do { 129 a = a.Parent; 130 } while (a != null && !(a is AlgorithmView)); 131 132 if (a is AlgorithmView) { 133 i = ((AlgorithmView)a).Content; 134 } 135 136 return i; 137 138 //AlgorithmView algV = a as AlgorithmView; 139 //var clone = (IContent)algV.Content.Clone(new Cloner()); 140 //MainFormManager.MainForm.ShowContent(clone); 141 122 return itemView.Content; 142 123 } 143 124 }
Note: See TracChangeset
for help on using the changeset viewer.