Changeset 13508 for trunk/sources/HeuristicLab.DataPreprocessing
- Timestamp:
- 01/14/16 17:51:48 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.DataPreprocessing/3.4
- Files:
-
- 3 added
- 3 deleted
- 3 edited
- 27 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/CorrelationMatrixContent.cs
r13507 r13508 21 21 22 22 using System.Drawing; 23 using System.Linq;24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Core; … … 40 39 public DataAnalysisProblemData ProblemData { 41 40 get { 42 // ToDo: avoid iterating 43 return Context.ExportPossibilities.Select(p => p.Value()).OfType<DataAnalysisProblemData>().Single(); 41 return (DataAnalysisProblemData)Context.CreateNewProblemData(); 44 42 //var creator = new ProblemDataCreator(Context); 45 43 //return (DataAnalysisProblemData)creator.CreateProblemData(); -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/DataCompletenessChartContent.cs
r13507 r13508 11 11 } 12 12 13 public IDataGridLogic DataGridLogic { get; private set; }14 public ISearchLogic SearchLogic { get; private set; }13 //public DataGridLogic DataGridLogic { get; private set; } 14 public SearchLogic SearchLogic { get; private set; } 15 15 16 16 public DataCompletenessChartContent(SearchLogic searchLogic) { -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/DataGridContent.cs
r13507 r13508 38 38 } 39 39 40 public IManipulationLogic ManipulationLogic { get; private set; }41 public IFilterLogic FilterLogic { get; private set; }40 public ManipulationLogic ManipulationLogic { get; private set; } 41 public FilterLogic FilterLogic { get; private set; } 42 42 43 43 public int Rows { … … 97 97 98 98 99 public DataGridContent(ITransactionalPreprocessingData preProcessingData, IManipulationLogic theManipulationLogic, IFilterLogic theFilterLogic) {99 public DataGridContent(ITransactionalPreprocessingData preProcessingData, ManipulationLogic theManipulationLogic, FilterLogic theFilterLogic) { 100 100 ManipulationLogic = theManipulationLogic; 101 101 FilterLogic = theFilterLogic; -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/FilterContent.cs
r13507 r13508 35 35 private ICheckedItemCollection<IFilter> filters = new CheckedItemCollection<IFilter>(); 36 36 37 public IFilterLogic FilterLogic { get; private set; }37 public FilterLogic FilterLogic { get; private set; } 38 38 39 39 public ICheckedItemCollection<IFilter> Filters { … … 56 56 } 57 57 58 public FilterContent( IFilterLogic filterLogic) {58 public FilterContent(FilterLogic filterLogic) { 59 59 FilterLogic = filterLogic; 60 60 } -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/IDataGridContent.cs
r13507 r13508 26 26 public interface IDataGridContent : IStringConvertibleMatrix { 27 27 ITransactionalPreprocessingData PreProcessingData { get; } 28 IManipulationLogic ManipulationLogic { get; }29 IFilterLogic FilterLogic { get; }28 ManipulationLogic ManipulationLogic { get; } 29 FilterLogic FilterLogic { get; } 30 30 31 31 IDictionary<int, IList<int>> Selection { get; set; } -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/ManipulationContent.cs
r13507 r13508 29 29 public class ManipulationContent : Item, IViewShortcut { 30 30 31 private IManipulationLogic manipulationLogic;32 private ISearchLogic searchLogic;33 private IFilterLogic filterLogic;31 private ManipulationLogic manipulationLogic; 32 private SearchLogic searchLogic; 33 private FilterLogic filterLogic; 34 34 35 public IManipulationLogic ManipulationLogic { get { return manipulationLogic; } }36 public ISearchLogic SearchLogic { get { return searchLogic; } }37 public IFilterLogic FilterLogic { get { return filterLogic; } }35 public ManipulationLogic ManipulationLogic { get { return manipulationLogic; } } 36 public SearchLogic SearchLogic { get { return searchLogic; } } 37 public FilterLogic FilterLogic { get { return filterLogic; } } 38 38 39 39 public static new Image StaticItemImage { … … 41 41 } 42 42 43 public ManipulationContent( IManipulationLogic theManipulationLogic, ISearchLogic theSearchLogic, IFilterLogic theFilterLogic) {43 public ManipulationContent(ManipulationLogic theManipulationLogic, SearchLogic theSearchLogic, FilterLogic theFilterLogic) { 44 44 manipulationLogic = theManipulationLogic; 45 45 searchLogic = theSearchLogic; -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/StatisticsContent.cs
r13507 r13508 28 28 public class StatisticsContent : Item, IViewShortcut { 29 29 30 private readonly IStatisticsLogic statisticsLogic;31 public StatisticsContent( IStatisticsLogic theStatisticsLogic) {30 private readonly StatisticsLogic statisticsLogic; 31 public StatisticsContent(StatisticsLogic theStatisticsLogic) { 32 32 statisticsLogic = theStatisticsLogic; 33 33 } … … 38 38 } 39 39 40 public IStatisticsLogic StatisticsLogic {40 public StatisticsLogic StatisticsLogic { 41 41 get { return statisticsLogic; } 42 42 } -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Content/TransformationContent.cs
r13507 r13508 30 30 31 31 public IPreprocessingData Data { get; private set; } 32 public IFilterLogic FilterLogic { get; private set; }32 public FilterLogic FilterLogic { get; private set; } 33 33 34 34 public ICheckedItemList<ITransformation> CheckedTransformationList { get; private set; } … … 38 38 } 39 39 40 public TransformationContent(IPreprocessingData data, IFilterLogic filterLogic) {40 public TransformationContent(IPreprocessingData data, FilterLogic filterLogic) { 41 41 Data = data; 42 42 CheckedTransformationList = new CheckedItemList<ITransformation>(); -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/HeuristicLab.DataPreprocessing-3.4.csproj
r13502 r13508 78 78 </ItemGroup> 79 79 <ItemGroup> 80 <Compile Include=" Implementations\ScatterPlotContent.cs" />81 <Compile Include=" Implementations\DataCompletenessChartContent.cs" />82 <Compile Include=" Implementations\FilteredPreprocessingData.cs" />83 <Compile Include=" Implementations\ManipulationContent.cs" />84 <Compile Include=" Implementations\PreprocessingChartContent.cs" />85 <Compile Include=" Implementations\PreprocessingData.cs" />86 <Compile Include=" Implementations\PreprocessingDataTable.cs" />87 <Compile Include=" Interfaces\IViewChartShortcut.cs" />88 <Compile Include=" Interfaces\IFilteredPreprocessingData.cs" />89 <Compile Include=" Implementations\CorrelationMatrixContent.cs" />80 <Compile Include="Content\ScatterPlotContent.cs" /> 81 <Compile Include="Content\DataCompletenessChartContent.cs" /> 82 <Compile Include="Data\FilteredPreprocessingData.cs" /> 83 <Compile Include="Content\ManipulationContent.cs" /> 84 <Compile Include="Content\PreprocessingChartContent.cs" /> 85 <Compile Include="Data\PreprocessingData.cs" /> 86 <Compile Include="Content\PreprocessingDataTable.cs" /> 87 <Compile Include="Content\IViewChartShortcut.cs" /> 88 <Compile Include="Data\IFilteredPreprocessingData.cs" /> 89 <Compile Include="Content\CorrelationMatrixContent.cs" /> 90 90 <Compile Include="PreprocessingTransformator.cs" /> 91 <Compile Include="Utils\DataPreprocessingChangedEvent.cs" /> 92 <Compile Include="Implementations\Filter\ComparisonFilter.cs" /> 93 <Compile Include="Implementations\Filter\IFilter.cs" /> 94 <Compile Include="Implementations\ManipulationLogic.cs" /> 95 <Compile Include="Interfaces\IPreprocessingData.cs" /> 96 <Compile Include="Interfaces\IDataGridLogic.cs" /> 97 <Compile Include="Implementations\FilterContent.cs" /> 98 <Compile Include="Implementations\FilterLogic.cs" /> 99 <Compile Include="Implementations\HistogramContent.cs" /> 100 <Compile Include="Implementations\LineChartContent.cs" /> 101 <Compile Include="Implementations\StatisticsContent.cs" /> 102 <Compile Include="Implementations\TransformationContent.cs" /> 103 <Compile Include="Interfaces\IFilterLogic.cs" /> 104 <Compile Include="Interfaces\IManipulationLogic.cs" /> 105 <Compile Include="Interfaces\ITransformationLogic.cs" /> 106 <Compile Include="Interfaces\IViewShortcut.cs" /> 91 <Compile Include="Data\DataPreprocessingChangedEvent.cs" /> 92 <Compile Include="Logic\Filter\ComparisonFilter.cs" /> 93 <Compile Include="Logic\Filter\IFilter.cs" /> 94 <Compile Include="Logic\ManipulationLogic.cs" /> 95 <Compile Include="Data\IPreprocessingData.cs" /> 96 <Compile Include="Content\FilterContent.cs" /> 97 <Compile Include="Logic\FilterLogic.cs" /> 98 <Compile Include="Content\HistogramContent.cs" /> 99 <Compile Include="Content\LineChartContent.cs" /> 100 <Compile Include="Content\StatisticsContent.cs" /> 101 <Compile Include="Content\TransformationContent.cs" /> 102 <Compile Include="Content\IViewShortcut.cs" /> 107 103 <Compile Include="ProblemDataCreator.cs" /> 108 104 <None Include="Plugin.cs.frame" /> 109 <Compile Include=" Implementations\DataGridContent.cs" />105 <Compile Include="Content\DataGridContent.cs" /> 110 106 <Compile Include="PreprocessingContext.cs" /> 111 <Compile Include="Implementations\TransactionalPreprocessingData.cs" /> 112 <Compile Include="Implementations\SearchLogic.cs" /> 113 <Compile Include="Implementations\StatisticsLogic.cs" /> 114 <Compile Include="Interfaces\IDataGridContent.cs" /> 115 <Compile Include="Interfaces\ISearchLogic.cs" /> 116 <Compile Include="Interfaces\IStatisticsLogic.cs" /> 117 <Compile Include="Interfaces\ITransactionalPreprocessingData.cs" /> 107 <Compile Include="Data\TransactionalPreprocessingData.cs" /> 108 <Compile Include="Logic\SearchLogic.cs" /> 109 <Compile Include="Logic\StatisticsLogic.cs" /> 110 <Compile Include="Content\IDataGridContent.cs" /> 111 <Compile Include="Data\ITransactionalPreprocessingData.cs" /> 118 112 <Compile Include="Plugin.cs" /> 119 113 <Compile Include="Properties\AssemblyInfo.cs" /> … … 162 156 <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project> 163 157 <Name>HeuristicLab.Persistence-3.3</Name> 158 <Private>False</Private> 164 159 </ProjectReference> 165 160 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Logic/FilterLogic.cs
r13507 r13508 26 26 27 27 namespace HeuristicLab.DataPreprocessing { 28 public class FilterLogic : IFilterLogic{28 public class FilterLogic { 29 29 30 30 public IFilteredPreprocessingData PreprocessingData { get; private set; } -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Logic/ManipulationLogic.cs
r13507 r13508 26 26 27 27 namespace HeuristicLab.DataPreprocessing { 28 public class ManipulationLogic : IManipulationLogic{28 public class ManipulationLogic { 29 29 private readonly ITransactionalPreprocessingData preprocessingData; 30 private readonly IStatisticsLogic statisticsLogic;31 private readonly ISearchLogic searchLogic;30 private readonly StatisticsLogic statisticsLogic; 31 private readonly SearchLogic searchLogic; 32 32 33 33 public IEnumerable<string> VariableNames { … … 39 39 } 40 40 41 public ManipulationLogic(ITransactionalPreprocessingData _prepocessingData, ISearchLogic theSearchLogic, IStatisticsLogic theStatisticsLogic) {41 public ManipulationLogic(ITransactionalPreprocessingData _prepocessingData, SearchLogic theSearchLogic, StatisticsLogic theStatisticsLogic) { 42 42 preprocessingData = _prepocessingData; 43 43 searchLogic = theSearchLogic; … … 51 51 } 52 52 53 public void ReplaceIndicesByAverageValue(IDictionary<int, IList<int>> cells, bool considerSelection ) {53 public void ReplaceIndicesByAverageValue(IDictionary<int, IList<int>> cells, bool considerSelection = false) { 54 54 preprocessingData.InTransaction(() => { 55 55 foreach (var column in cells) { … … 65 65 } 66 66 67 public void ReplaceIndicesByMedianValue(IDictionary<int, IList<int>> cells, bool considerSelection ) {67 public void ReplaceIndicesByMedianValue(IDictionary<int, IList<int>> cells, bool considerSelection = false) { 68 68 preprocessingData.InTransaction(() => { 69 69 foreach (var column in cells) { … … 79 79 } 80 80 81 public void ReplaceIndicesByRandomValue(IDictionary<int, IList<int>> cells, bool considerSelection ) {81 public void ReplaceIndicesByRandomValue(IDictionary<int, IList<int>> cells, bool considerSelection = false) { 82 82 preprocessingData.InTransaction(() => { 83 83 Random r = new Random(); … … 209 209 } 210 210 211 public void ReplaceIndicesByMostCommonValue(IDictionary<int, IList<int>> cells, bool considerSelection ) {211 public void ReplaceIndicesByMostCommonValue(IDictionary<int, IList<int>> cells, bool considerSelection = false) { 212 212 preprocessingData.InTransaction(() => { 213 213 foreach (var column in cells) { -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Logic/SearchLogic.cs
r13507 r13508 25 25 26 26 namespace HeuristicLab.DataPreprocessing { 27 public class SearchLogic : ISearchLogic{27 public class SearchLogic { 28 28 private readonly ITransactionalPreprocessingData preprocessingData; 29 private readonly IFilterLogic filterLogic;29 private readonly FilterLogic filterLogic; 30 30 31 31 private Dictionary<int, IList<int>> MissingValueIndicies { get; set; } … … 44 44 } 45 45 46 public SearchLogic(ITransactionalPreprocessingData thePreprocessingData, IFilterLogic theFilterLogic) {46 public SearchLogic(ITransactionalPreprocessingData thePreprocessingData, FilterLogic theFilterLogic) { 47 47 preprocessingData = thePreprocessingData; 48 48 filterLogic = theFilterLogic; -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/Logic/StatisticsLogic.cs
r13507 r13508 26 26 27 27 namespace HeuristicLab.DataPreprocessing { 28 public class StatisticsLogic : IStatisticsLogic{28 public class StatisticsLogic { 29 29 30 30 private readonly ITransactionalPreprocessingData preprocessingData; 31 private readonly ISearchLogic searchLogic;32 33 public StatisticsLogic(ITransactionalPreprocessingData thePreprocessingData, ISearchLogic theSearchLogic) {31 private readonly SearchLogic searchLogic; 32 33 public StatisticsLogic(ITransactionalPreprocessingData thePreprocessingData, SearchLogic theSearchLogic) { 34 34 preprocessingData = thePreprocessingData; 35 35 searchLogic = theSearchLogic; … … 71 71 } 72 72 73 public T GetMin<T>(int columnIndex, bool considerSelection ) where T : IComparable<T> {73 public T GetMin<T>(int columnIndex, bool considerSelection = false) where T : IComparable<T> { 74 74 var min = default(T); 75 75 if (preprocessingData.VariableHasType<T>(columnIndex)) { … … 82 82 } 83 83 84 public T GetMax<T>(int columnIndex, bool considerSelection ) where T : IComparable<T> {84 public T GetMax<T>(int columnIndex, bool considerSelection = false) where T : IComparable<T> { 85 85 var max = default(T); 86 86 if (preprocessingData.VariableHasType<T>(columnIndex)) { … … 93 93 } 94 94 95 public double GetMedian(int columnIndex, bool considerSelection ) {95 public double GetMedian(int columnIndex, bool considerSelection = false) { 96 96 double median = double.NaN; 97 97 if (preprocessingData.VariableHasType<double>(columnIndex)) { … … 104 104 } 105 105 106 public double GetAverage(int columnIndex, bool considerSelection ) {106 public double GetAverage(int columnIndex, bool considerSelection = false) { 107 107 double avg = double.NaN; 108 108 if (preprocessingData.VariableHasType<double>(columnIndex)) { … … 115 115 } 116 116 117 public DateTime GetMedianDateTime(int columnIndex, bool considerSelection ) {117 public DateTime GetMedianDateTime(int columnIndex, bool considerSelection = false) { 118 118 DateTime median = new DateTime(); 119 119 if (preprocessingData.VariableHasType<DateTime>(columnIndex)) { … … 123 123 } 124 124 125 public DateTime GetAverageDateTime(int columnIndex, bool considerSelection ) {125 public DateTime GetAverageDateTime(int columnIndex, bool considerSelection = false) { 126 126 DateTime avg = new DateTime(); 127 127 if (preprocessingData.VariableHasType<DateTime>(columnIndex)) { … … 131 131 } 132 132 133 public T GetMostCommonValue<T>(int columnIndex, bool considerSelection ) {133 public T GetMostCommonValue<T>(int columnIndex, bool considerSelection = false) { 134 134 var values = GetValuesWithoutNaN<T>(columnIndex, considerSelection); 135 135 if (!values.Any()) -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/PreprocessingContext.cs
r13507 r13508 35 35 public string Filename { get; set; } 36 36 37 public IEnumerable<KeyValuePair<string, Func<IItem>>> ExportPossibilities {38 get {39 var algorithm = Source as IAlgorithm;40 if (algorithm != null)41 yield return new KeyValuePair<string, Func<IItem>>(algorithm.GetType().GetPrettyName(), () => ExportAlgorithm(algorithm));42 43 var problem = algorithm != null ? algorithm.Problem as IDataAnalysisProblem : Source as IDataAnalysisProblem;44 if (problem != null)45 yield return new KeyValuePair<string, Func<IItem>>(problem.GetType().GetPrettyName(), () => ExportProblem(problem));46 47 var problemData = problem != null ? problem.ProblemData : Source as IDataAnalysisProblemData;48 if (problemData != null)49 yield return new KeyValuePair<string, Func<IItem>>(problemData.GetType().GetPrettyName(), () => ExportProblemData(problemData));50 51 // ToDo: Export CSV52 }53 }54 public bool CanExport {55 get { return Source is IAlgorithm || Source is IDataAnalysisProblem || Source is IDataAnalysisProblemData; }56 }57 58 37 [Storable] 59 38 public IFilteredPreprocessingData Data { get; private set; } … … 62 41 private IItem Source { get; set; } 63 42 43 public event EventHandler Reset; 64 44 65 public PreprocessingContext() : this(new RegressionProblemData()) { 66 Name = "Data Preprocessing"; 45 #region Constructors 46 public PreprocessingContext() 47 : this(new RegressionProblemData()) { 67 48 } 68 public PreprocessingContext(I Item source)49 public PreprocessingContext(IDataAnalysisProblemData problemData, IItem source = null) 69 50 : base("Data Preprocessing") { 70 Import(source); 51 if (problemData == null) throw new ArgumentNullException("problemData"); 52 Import(problemData, source); 71 53 } 72 54 … … 79 61 Data = cloner.Clone(original.Data); 80 62 } 81 82 63 public override IDeepCloneable Clone(Cloner cloner) { 83 64 return new PreprocessingContext(this, cloner); 84 65 } 66 #endregion 85 67 86 68 #region Import 87 public void Import(IItem source) { 88 Source = source; 89 var namedSource = source as INamedItem; 90 if (namedSource != null) Name = "Preprocessing: " + namedSource.Name; 91 92 var dataSource = ExtractProblemData(source); 93 Data = new FilteredPreprocessingData(new TransactionalPreprocessingData(dataSource)); 69 public void Import(IDataAnalysisProblemData problemData, IItem source = null) { 70 if (problemData == null) throw new ArgumentNullException("problemData"); 71 if (source != null && ExtractProblemData(source) != problemData) 72 throw new ArgumentException("The ProblemData extracted from the Source is different than the given ProblemData."); 73 Source = source ?? problemData; 74 var namedSource = Source as INamedItem; 75 if (namedSource != null) 76 Name = "Preprocessing " + namedSource.Name; 77 Data = new FilteredPreprocessingData(new TransactionalPreprocessingData(problemData)); 78 OnReset(); 79 // Reset GUI: 80 // - OnContentChanged for PreprocessingView! 81 // event? task(async import)? 94 82 } 95 96 83 private IDataAnalysisProblemData ExtractProblemData(IItem source) { 97 84 var algorithm = source as Algorithm; … … 103 90 104 91 #region Export 105 public IItem Export() { 106 if (Source is IAlgorithm) 107 return ExportAlgorithm((IAlgorithm)Source); 108 if (Source is IDataAnalysisProblem) 109 return ExportProblem((IDataAnalysisProblem)Source); 110 if (Source is IDataAnalysisProblemData) 111 return ExportProblemData((IDataAnalysisProblemData)Source); 112 return null; 92 public bool CanExport { 93 get { return Source is IAlgorithm || Source is IDataAnalysisProblem || Source is IDataAnalysisProblemData; } 113 94 } 95 public IEnumerable<KeyValuePair<string, Func<IItem>>> GetSourceExportOptions() { 96 var algorithm = Source as IAlgorithm; 97 if (algorithm != null) 98 yield return new KeyValuePair<string, Func<IItem>>( 99 algorithm.GetType().GetPrettyName(), 100 () => ExportAlgorithm(algorithm)); 101 102 var problem = algorithm != null ? algorithm.Problem as IDataAnalysisProblem : Source as IDataAnalysisProblem; 103 if (problem != null) 104 yield return new KeyValuePair<string, Func<IItem>>( 105 problem.GetType().GetPrettyName(), 106 () => ExportProblem(problem)); 107 108 var problemData = problem != null ? problem.ProblemData : Source as IDataAnalysisProblemData; 109 if (problemData != null) 110 yield return new KeyValuePair<string, Func<IItem>>( 111 problemData.GetType().GetPrettyName(), 112 () => ExportProblemData(problemData)); 113 } 114 114 115 private IAlgorithm ExportAlgorithm(IAlgorithm source) { 115 116 var preprocessedAlgorithm = (IAlgorithm)source.Clone(); … … 117 118 preprocessedAlgorithm.Runs.Clear(); 118 119 var problem = (IDataAnalysisProblem)preprocessedAlgorithm.Problem; 119 SetNewProblemData(problem);120 problem.ProblemDataParameter.ActualValue = CreateNewProblemData(); 120 121 return preprocessedAlgorithm; 121 122 } 122 123 private IDataAnalysisProblem ExportProblem(IDataAnalysisProblem source) { 123 124 var preprocessedProblem = (IDataAnalysisProblem)source.Clone(); 124 SetNewProblemData(preprocessedProblem);125 preprocessedProblem.ProblemDataParameter.ActualValue = CreateNewProblemData(); 125 126 return preprocessedProblem; 126 127 } 127 128 private IDataAnalysisProblemData ExportProblemData(IDataAnalysisProblemData source) { 129 return CreateNewProblemData(); 130 } 131 132 public IDataAnalysisProblemData CreateNewProblemData() { 128 133 var creator = new ProblemDataCreator(this); 129 var preprocessedProblemData = creator.CreateProblemData(source); 130 preprocessedProblemData.Name = "Preprocessed " + source.Name; 131 return preprocessedProblemData; 132 } 133 private void SetNewProblemData(IDataAnalysisProblem problem) { 134 var data = ExtractProblemData(problem.ProblemData); 135 problem.ProblemDataParameter.ActualValue = data; 136 problem.Name = "Preprocessed " + problem.Name; 134 var oldProblemData = ExtractProblemData(Source); 135 var newProblemData = creator.CreateProblemData(oldProblemData); 136 newProblemData.Name = "Preprocessed " + oldProblemData.Name; 137 return newProblemData; 137 138 } 138 139 #endregion 140 141 protected virtual void OnReset() { 142 if (Reset != null) 143 Reset(this, EventArgs.Empty); 144 } 139 145 } 140 146 } -
trunk/sources/HeuristicLab.DataPreprocessing/3.4/ProblemDataCreator.cs
r13502 r13508 48 48 IDataAnalysisProblemData problemData; 49 49 50 if (oldProblemData is RegressionProblemData) { 50 if (oldProblemData is TimeSeriesPrognosisProblemData) { 51 problemData = CreateTimeSeriesPrognosisData((TimeSeriesPrognosisProblemData)oldProblemData); 52 } else if (oldProblemData is RegressionProblemData) { 51 53 problemData = CreateRegressionData((RegressionProblemData)oldProblemData); 52 54 } else if (oldProblemData is ClassificationProblemData) { … … 69 71 } 70 72 73 private IDataAnalysisProblemData CreateTimeSeriesPrognosisData(TimeSeriesPrognosisProblemData oldProblemData) { 74 var targetVariable = oldProblemData.TargetVariable; 75 if (!context.Data.VariableNames.Contains(targetVariable)) 76 targetVariable = context.Data.VariableNames.First(); 77 var inputVariables = GetDoubleInputVariables(targetVariable); 78 var newProblemData = new TimeSeriesPrognosisProblemData(ExportedDataset, inputVariables, targetVariable, Transformations) { 79 TrainingHorizon = oldProblemData.TrainingHorizon, 80 TestHorizon = oldProblemData.TestHorizon 81 }; 82 return newProblemData; 83 } 84 71 85 private IDataAnalysisProblemData CreateRegressionData(RegressionProblemData oldProblemData) { 72 86 var targetVariable = oldProblemData.TargetVariable; … … 83 97 targetVariable = context.Data.VariableNames.First(); 84 98 var inputVariables = GetDoubleInputVariables(targetVariable); 85 var newProblemData = new ClassificationProblemData(ExportedDataset, inputVariables, targetVariable, Transformations); 86 newProblemData.PositiveClass = oldProblemData.PositiveClass; 99 var newProblemData = new ClassificationProblemData(ExportedDataset, inputVariables, targetVariable, Transformations) { 100 PositiveClass = oldProblemData.PositiveClass 101 }; 87 102 return newProblemData; 88 103 }
Note: See TracChangeset
for help on using the changeset viewer.