Changeset 17391 for branches/3044_variableScaling/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression
- Timestamp:
- 12/20/19 14:00:09 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3044_variableScaling/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r17388 r17391 170 170 private void RegisterParameterEvents() { 171 171 TargetVariableParameter.ValueChanged += new EventHandler(TargetVariableParameter_ValueChanged); 172 ScaleInputsParameter.Value.ValueChanged += new EventHandler(ScaleInputsParameter_ValueChanged); 172 173 } 173 174 private void TargetVariableParameter_ValueChanged(object sender, EventArgs e) { 174 175 OnChanged(); 175 176 } 177 178 private void ScaleInputsParameter_ValueChanged(object sender, EventArgs e) { 179 var transformations = new ShiftStandardDistributionTransformation(Dataset.DoubleVariables); 180 transformations.Mean = 0; 181 transformations.StandardDeviation = 1; 182 var scaling = Transformation.CreateTransformations(transformations, Dataset, TrainingIndices, AllowedInputVariables); 183 184 var scaledVariables = AllowedInputVariables.Select((var, i) => new { Variable = var, Data = scaling[i].Apply(Dataset.GetDoubleValues(var)).ToArray() }); 185 var newDataset = ((Dataset)Dataset).ToModifiable(); 186 187 foreach (var v in scaledVariables) { 188 newDataset.ReplaceVariable(v.Variable, v.Data); 189 } 190 191 if (!Parameters.ContainsKey("Scaled Dataset")) 192 Parameters.Add(new FixedValueParameter<Dataset>("Scaled Dataset", newDataset.ToDataset())); 193 } 176 194 } 177 195 }
Note: See TracChangeset
for help on using the changeset viewer.