Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17422 for trunk


Ignore:
Timestamp:
02/05/20 13:27:49 (5 years ago)
Author:
fholzing
Message:

#3054: Explicitly used problemData.AllowedInputVariables instead of modifiableDataset.VariableNames

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationSolutionVariableImpactsCalculator.cs

    r17180 r17422  
    2626using System.Collections.Generic;
    2727using System.Linq;
     28using HEAL.Attic;
    2829using HeuristicLab.Common;
    2930using HeuristicLab.Core;
    3031using HeuristicLab.Data;
    3132using HeuristicLab.Parameters;
    32 using HEAL.Attic;
    3333using HeuristicLab.Random;
    3434
     
    173173
    174174      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);
    178178      double impact = quality - newValue;
    179179
     
    184184      string variableName,
    185185      IClassificationModel model,
     186      IEnumerable<string> allowedInputVariables,
    186187      IEnumerable<int> rows,
    187188      IEnumerable<double> targetValues,
     
    196197      } else if (modifiableDataset.VariableHasType<string>(variableName)) {
    197198        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);
    199200      } else {
    200201        throw new NotSupportedException("Variable not supported");
     
    254255    private static IList GetReplacementValuesForString(IClassificationModel model,
    255256      ModifiableDataset modifiableDataset,
     257      IEnumerable<string> allowedInputVariables,
    256258      string variableName,
    257259      IEnumerable<int> rows,
     
    270272            List<string> curReplacementValues = Enumerable.Repeat(repl, modifiableDataset.Rows).ToList();
    271273            //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);
    273275            var curQuality = newValue;
    274276
     
    308310      IClassificationModel model,
    309311      ModifiableDataset modifiableDataset,
     312      IEnumerable<string> allowedInputVariables,
    310313      string variableName,
    311314      IList originalValues,
     
    317320      var discModel = model as IDiscriminantFunctionClassificationModel;
    318321      if (discModel != null) {
    319         var problemData = new ClassificationProblemData(modifiableDataset, modifiableDataset.VariableNames, model.TargetVariable);
     322        var problemData = new ClassificationProblemData(modifiableDataset, allowedInputVariables, model.TargetVariable);
    320323        discModel.RecalculateModelParameters(problemData, rows);
    321324      }
Note: See TracChangeset for help on using the changeset viewer.