Changeset 10695 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/ProblemDataCreator.cs
- Timestamp:
- 04/02/14 11:38:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/ProblemDataCreator.cs
r10536 r10695 29 29 private readonly IPreprocessingContext context; 30 30 31 private Dataset ExportedDataset { 32 get { return exporteDataset ?? (exporteDataset = context.Data.ExportToDataset()); } 33 } 34 private Dataset exporteDataset; 35 36 private IEnumerable<string> InputVariables { get { return context.Data.VariableNames; } } 37 private IEnumerable<ITransformation> Transformations { get { return context.Data.Transformations; } } 38 39 31 40 public ProblemDataCreator(IPreprocessingContext context) { 32 41 this.context = context; … … 38 47 IDataAnalysisProblemData problemData = null; 39 48 40 var dataSet = context.Data.ExportToDataset();41 var inputVariables = context.Data.VariableNames;42 43 49 if (oldProblemData is RegressionProblemData) { 44 problemData = CreateRegressionData((RegressionProblemData)oldProblemData , dataSet, inputVariables);50 problemData = CreateRegressionData((RegressionProblemData)oldProblemData); 45 51 } else if (oldProblemData is ClassificationProblemData) { 46 problemData = CreateClassificationData((ClassificationProblemData)oldProblemData , dataSet, inputVariables);52 problemData = CreateClassificationData((ClassificationProblemData)oldProblemData); 47 53 } else if (oldProblemData is ClusteringProblemData) { 48 problemData = CreateClusteringData((ClusteringProblemData)oldProblemData , dataSet, inputVariables);54 problemData = CreateClusteringData((ClusteringProblemData)oldProblemData); 49 55 } else { 50 56 throw new NotImplementedException("The type of the DataAnalysisProblemData is not supported."); … … 56 62 } 57 63 58 private IDataAnalysisProblemData CreateRegressionData(RegressionProblemData oldProblemData , Dataset dataSet, IEnumerable<string> inputVariables) {64 private IDataAnalysisProblemData CreateRegressionData(RegressionProblemData oldProblemData) { 59 65 var targetVariable = oldProblemData.TargetVariable; 60 66 // target variable must be double and must exist in the new dataset 61 return new RegressionProblemData( dataSet, inputVariables, targetVariable);67 return new RegressionProblemData(ExportedDataset, InputVariables, targetVariable, Transformations); 62 68 } 63 69 64 private IDataAnalysisProblemData CreateClassificationData(ClassificationProblemData oldProblemData , Dataset dataSet, IEnumerable<string> inputVariables) {70 private IDataAnalysisProblemData CreateClassificationData(ClassificationProblemData oldProblemData) { 65 71 var targetVariable = oldProblemData.TargetVariable; 66 72 // target variable must be double and must exist in the new dataset 67 return new ClassificationProblemData( dataSet, inputVariables, targetVariable);73 return new ClassificationProblemData(ExportedDataset, InputVariables, targetVariable, Transformations); 68 74 } 69 75 70 private IDataAnalysisProblemData CreateClusteringData(ClusteringProblemData oldProblemData , Dataset dataSet, IEnumerable<string> inputVariables) {71 return new ClusteringProblemData( dataSet, inputVariables);76 private IDataAnalysisProblemData CreateClusteringData(ClusteringProblemData oldProblemData) { 77 return new ClusteringProblemData(ExportedDataset, InputVariables, Transformations); 72 78 } 73 79
Note: See TracChangeset
for help on using the changeset viewer.