Changeset 15880 for branches/2906_Transformations
- Timestamp:
- 03/30/18 15:49:51 (7 years ago)
- Location:
- branches/2906_Transformations
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2906_Transformations/HeuristicLab.DataPreprocessing/3.4/ProblemDataCreator.cs
r15870 r15880 118 118 119 119 void SetAllowedInputVariables(IDataAnalysisProblemData problemData, IEnumerable<string> oldInputVariables) { 120 var inputs = DataAnalysis ProblemData.ExtendInputVariables(oldInputVariables, problemData.Transformations);120 var inputs = DataAnalysisTransformationModel.ExtendInputVariables(oldInputVariables, problemData.Transformations); 121 121 122 122 foreach (var input in problemData.InputVariables) { -
branches/2906_Transformations/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisTransformationModel.cs
r15870 r15880 80 80 #endregion 81 81 82 // extended -> include originals 82 83 public static ISet<string> CalculateTransitiveVariables(IEnumerable<string> inputVariables, IEnumerable<IDataAnalysisTransformation> transformations) { 83 84 var transitiveInputs = new HashSet<string>(inputVariables); … … 90 91 91 92 return transitiveInputs; 93 } 94 // originals => include extended 95 public static IEnumerable<string> ExtendInputVariables(IEnumerable<string> oldInputVariables, IEnumerable<IDataAnalysisTransformation> transformations) { 96 var inputs = new HashSet<string>(oldInputVariables); 97 98 foreach (var transformation in transformations) { 99 if (inputs.Contains(transformation.OriginalVariable)) 100 inputs.Add(transformation.TransformedVariable); 101 } 102 103 return inputs; 104 } 105 [Obsolete] 106 public static IEnumerable<string> RemoveVirtualVariables(IEnumerable<string> variables, IEnumerable<IDataAnalysisTransformation> transformations) { 107 var remainingVariables = new HashSet<string>(variables); 108 109 var transformationsStack = new Stack<IDataAnalysisTransformation>(transformations); 110 111 while (transformationsStack.Any()) { 112 var transformation = transformationsStack.Pop(); 113 114 115 bool transformedVariablePending = transformationsStack.Any(x => x.OriginalVariable == transformation.TransformedVariable); 116 if (!transformedVariablePending) 117 remainingVariables.Remove(transformation.TransformedVariable); 118 } 119 120 return remainingVariables; 92 121 } 93 122 … … 112 141 } 113 142 114 115 116 143 #region Events 117 144 public event EventHandler TargetVariableChanged; … … 122 149 } 123 150 #endregion 124 125 126 127 128 129 130 /*131 // dataset in original data range132 public override IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {133 var transformedDataset = Transform(dataset, Transformations);134 135 var estimates = OriginalModel.GetEstimatedValues(transformedDataset, rows);136 137 return InverseTransform(estimates, Transformations, OriginalModel.TargetVariable);138 }139 140 // problemData in original data range141 public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {142 // TODO: specialized views for the original solution type are lost (RandomForestSolutionView, ...)143 return new RegressionSolution(this, new RegressionProblemData(problemData));144 } */145 151 } 146 152 }
Note: See TracChangeset
for help on using the changeset viewer.