- Timestamp:
- 02/05/20 13:27:49 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolutionVariableImpactsCalculator.cs
r17180 r17422 26 26 using System.Collections.Generic; 27 27 using System.Linq; 28 using HEAL.Attic; 28 29 using HeuristicLab.Common; 29 30 using HeuristicLab.Core; 30 31 using HeuristicLab.Data; 31 32 using HeuristicLab.Parameters; 32 using HEAL.Attic;33 33 using HeuristicLab.Random; 34 34 … … 173 173 174 174 IList originalValues = null; 175 IList replacementValues = GetReplacementValues(modifiableDataset, variableName, model, rows, targetValues, out originalValues, replacementMethod, factorReplacementMethod);176 177 double newValue = CalculateQualityForReplacement(model, modifiableDataset, variableName, originalValues, rows, replacementValues, targetValues);175 IList replacementValues = GetReplacementValues(modifiableDataset, variableName, model, problemData.AllowedInputVariables, rows, targetValues, out originalValues, replacementMethod, factorReplacementMethod); 176 177 double newValue = CalculateQualityForReplacement(model, modifiableDataset, problemData.AllowedInputVariables, variableName, originalValues, rows, replacementValues, targetValues); 178 178 double impact = quality - newValue; 179 179 … … 184 184 string variableName, 185 185 IClassificationModel model, 186 IEnumerable<string> allowedInputVariables, 186 187 IEnumerable<int> rows, 187 188 IEnumerable<double> targetValues, … … 196 197 } else if (modifiableDataset.VariableHasType<string>(variableName)) { 197 198 originalValues = modifiableDataset.GetReadOnlyStringValues(variableName).ToList(); 198 replacementValues = GetReplacementValuesForString(model, modifiableDataset, variableName, rows, (List<string>)originalValues, targetValues, factorReplacementMethod);199 replacementValues = GetReplacementValuesForString(model, modifiableDataset, allowedInputVariables, variableName, rows, (List<string>)originalValues, targetValues, factorReplacementMethod); 199 200 } else { 200 201 throw new NotSupportedException("Variable not supported"); … … 254 255 private static IList GetReplacementValuesForString(IClassificationModel model, 255 256 ModifiableDataset modifiableDataset, 257 IEnumerable<string> allowedInputVariables, 256 258 string variableName, 257 259 IEnumerable<int> rows, … … 270 272 List<string> curReplacementValues = Enumerable.Repeat(repl, modifiableDataset.Rows).ToList(); 271 273 //fholzing: this result could be used later on (theoretically), but is neglected for better readability/method consistency 272 var newValue = CalculateQualityForReplacement(model, modifiableDataset, variableName, originalValues, rows, curReplacementValues, targetValues);274 var newValue = CalculateQualityForReplacement(model, modifiableDataset, allowedInputVariables, variableName, originalValues, rows, curReplacementValues, targetValues); 273 275 var curQuality = newValue; 274 276 … … 308 310 IClassificationModel model, 309 311 ModifiableDataset modifiableDataset, 312 IEnumerable<string> allowedInputVariables, 310 313 string variableName, 311 314 IList originalValues, … … 317 320 var discModel = model as IDiscriminantFunctionClassificationModel; 318 321 if (discModel != null) { 319 var problemData = new ClassificationProblemData(modifiableDataset, modifiableDataset.VariableNames, model.TargetVariable);322 var problemData = new ClassificationProblemData(modifiableDataset, allowedInputVariables, model.TargetVariable); 320 323 discModel.RecalculateModelParameters(problemData, rows); 321 324 }
Note: See TracChangeset
for help on using the changeset viewer.