- Timestamp:
- 06/11/14 13:38:58 (10 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/CorrelationMatrixContent.cs
r10978 r10982 51 51 : base(original, cloner) { 52 52 } 53 53 54 public override IDeepCloneable Clone(Cloner cloner) { 54 55 return new CorrelationMatrixContent(this, cloner); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/ProblemDataCreator.cs
r10922 r10982 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Problems.DataAnalysis; 25 26 using HeuristicLab.Problems.DataAnalysis.Transformations; … … 35 36 private Dataset exporteDataset; 36 37 37 private IEnumerable<string> InputVariables { get { return context.Data.VariableNames; } }38 38 private IList<ITransformation> Transformations { get { return context.Data.Transformations; } } 39 39 … … 65 65 var targetVariable = oldProblemData.TargetVariable; 66 66 // target variable must be double and must exist in the new dataset 67 return new RegressionProblemData(ExportedDataset, InputVariables, targetVariable, Transformations);67 return new RegressionProblemData(ExportedDataset, GetDoubleInputVariables(targetVariable), targetVariable, Transformations); 68 68 } 69 69 … … 71 71 var targetVariable = oldProblemData.TargetVariable; 72 72 // target variable must be double and must exist in the new dataset 73 return new ClassificationProblemData(ExportedDataset, InputVariables, targetVariable, Transformations);73 return new ClassificationProblemData(ExportedDataset, GetDoubleInputVariables(targetVariable), targetVariable, Transformations); 74 74 } 75 75 76 76 private IDataAnalysisProblemData CreateClusteringData(ClusteringProblemData oldProblemData) { 77 return new ClusteringProblemData(ExportedDataset, InputVariables, Transformations);77 return new ClusteringProblemData(ExportedDataset, GetDoubleInputVariables(String.Empty), Transformations); 78 78 } 79 79 … … 86 86 problemData.TestPartition.End = ppData.TestPartition.End; 87 87 } 88 89 private IEnumerable<string> GetDoubleInputVariables(string targetVariable) { 90 var variableNames = new List<string>(); 91 for (int i = 0; i < context.Data.Columns; ++i) { 92 var variableName = context.Data.GetVariableName(i); 93 if (context.Data.IsType<double>(i) 94 && variableName != targetVariable 95 && IsNotConstantInputVariable(context.Data.GetValues<double>(i))) { 96 97 variableNames.Add(variableName); 98 } 99 } 100 return variableNames; 101 } 102 103 private bool IsNotConstantInputVariable(IList<double> list) { 104 return context.Data.TrainingPartition.End - context.Data.TrainingPartition.Start > 1 || list.Range() > 0; 105 } 88 106 } 89 107 }
Note: See TracChangeset
for help on using the changeset viewer.