Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/10/09 10:46:56 (15 years ago)
Author:
gkronber
Message:
  • Renamed VariableImpactCalculator to VariableQualityImpactCalculator and calculate the ratio of new quality value to old quality value to get an idea how the quality value is influenced by each variable.
  • Changes in Dataset to improve the speed of SetValue (only set a dirty flag instead of reallocating the caches)

#644 (Variable impact of CEDMA models should be calculated and stored in the result DB)

Location:
trunk/sources/HeuristicLab.Modeling/3.2
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Modeling/3.2/HeuristicLab.Modeling-3.2.csproj

    r2034 r2038  
    8383  <ItemGroup>
    8484    <Compile Include="ClassificationProblemInjector.cs" />
    85     <Compile Include="VariableImpactCalculator.cs" />
    8685    <Compile Include="Model.cs" />
    8786    <Compile Include="IModel.cs" />
     
    106105    <Compile Include="TimeSeriesProblemInjector.cs" />
    107106    <Compile Include="SimpleVarianceAccountedForEvaluator.cs" />
     107    <Compile Include="VariableQualityImpactCalculator.cs" />
    108108  </ItemGroup>
    109109  <ItemGroup>
  • trunk/sources/HeuristicLab.Modeling/3.2/VariableQualityImpactCalculator.cs

    r2037 r2038  
    3030
    3131namespace HeuristicLab.Modeling {
    32   public class VariableImpactCalculator : OperatorBase {
     32  public class VariableQualityImpactCalculator : OperatorBase {
    3333    public override string Description {
    3434      get { return @"Calculates the impact of all allowed input variables on the quality of the model using evaluator supplied as suboperator."; }
    3535    }
    3636
    37     public VariableImpactCalculator()
     37    public VariableQualityImpactCalculator()
    3838      : base() {
    3939      AddVariableInfo(new VariableInfo("Dataset", "Dataset", typeof(Dataset), VariableKind.In));
     
    4242      AddVariableInfo(new VariableInfo("TrainingSamplesStart", "TrainingSamplesStart", typeof(IntData), VariableKind.In));
    4343      AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "TrainingSamplesEnd", typeof(IntData), VariableKind.In));
    44       AddVariableInfo(new VariableInfo("VariableImpacts", "Variable impacts", typeof(ItemList), VariableKind.New));
     44      AddVariableInfo(new VariableInfo("VariableQualityImpacts", "Effect on quality of model (percentage of original quality) if variable is replaced by its mean.", typeof(ItemList), VariableKind.New));
    4545    }
    4646
     
    5353      int end = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data;
    5454
    55       if (SubOperators.Count < 1) throw new InvalidOperationException("VariableImpactCalculator needs a suboperator to evaluate the model");
     55      if (SubOperators.Count < 1) throw new InvalidOperationException("VariableQualityImpactCalculator needs a suboperator to evaluate the model");
    5656      IOperator evaluationOperator = this.SubOperators[0];
    57 
    58       ItemList variableImpacts = new ItemList();
     57      ItemList variableQualityImpacts = new ItemList();
    5958
    6059      // calculateReferenceQuality
     
    6564        var oldValues = ReplaceVariableValues(dirtyDataset, currentVariable , CalculateNewValues(dirtyDataset, currentVariable, start, end), start, end);
    6665        double newQuality = CalculateQuality(scope, dirtyDataset, evaluationOperator);
    67         double ratio = referenceQuality / newQuality;
    68         double impact = ratio < 1.0 ? 1.0 - ratio : 1.0 - 1.0 / ratio;
     66        double ratio = newQuality / referenceQuality;
    6967        ItemList row = new ItemList();
    7068        row.Add(new StringData(dataset.GetVariableName(currentVariable)));
    71         row.Add(new DoubleData(impact));
    72         variableImpacts.Add(row);
     69        row.Add(new DoubleData(ratio));
     70        variableQualityImpacts.Add(row);
    7371        ReplaceVariableValues(dirtyDataset, currentVariable, oldValues, start, end);
    7472      }
    75       scope.AddVariable(new Variable(scope.TranslateName("VariableImpacts"), variableImpacts));
     73      scope.AddVariable(new Variable(scope.TranslateName("VariableQualityImpacts"), variableQualityImpacts));
    7674      return null;
    7775    }
     
    9391
    9492      int index = start;
     93      ds.FireChangeEvents = false;
    9594      foreach(double v in newValues) {
    9695        ds.SetValue(index++, variableIndex, v);
    9796      }
     97      ds.FireChangeEvents = true;
     98      ds.FireChanged();
    9899      return oldValues;
    99100    }
Note: See TracChangeset for help on using the changeset viewer.