Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16017


Ignore:
Timestamp:
07/25/18 19:04:33 (6 years ago)
Author:
fholzing
Message:

#2904: Added IFixedValueParameter for factory variable replacement. Unified the default values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2904_CalculateImpacts/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs

    r16016 r16017  
    3737  [Item("RegressionSolution Impacts Calculator", "Calculation of the impacts of input variables for any regression solution")]
    3838  public sealed class RegressionSolutionVariableImpactsCalculator : ParameterizedNamedItem {
     39    private static IOnlineCalculator calculator = new OnlinePearsonsRSquaredCalculator();
     40
    3941    public enum ReplacementMethodEnum {
    4042      Median,
     
    5456    }
    5557
    56     //The PerasonsR²-Calculator is the default, but can be overwritten to any other IOnlineCalculator
    57     //Just remember to reset it after you're done
    58     private static IOnlineCalculator calculator = new OnlinePearsonsRSquaredCalculator();
    59     public static IOnlineCalculator Calculator
    60     {
    61       get { return calculator; }
    62       set { calculator = value; }
    63     }
    64 
    6558    private const string ReplacementParameterName = "Replacement Method";
     59    private const string FactorReplacementParameterName = "Factor Replacement Method";
    6660    private const string DataPartitionParameterName = "DataPartition";
    6761
     
    6963    {
    7064      get { return (IFixedValueParameter<EnumValue<ReplacementMethodEnum>>)Parameters[ReplacementParameterName]; }
     65    }
     66    public IFixedValueParameter<EnumValue<FactorReplacementMethodEnum>> FactorReplacementParameter
     67    {
     68      get { return (IFixedValueParameter<EnumValue<FactorReplacementMethodEnum>>)Parameters[FactorReplacementParameterName]; }
    7169    }
    7270    public IFixedValueParameter<EnumValue<DataPartitionEnum>> DataPartitionParameter
     
    7977      get { return ReplacementParameter.Value.Value; }
    8078      set { ReplacementParameter.Value.Value = value; }
     79    }
     80    public FactorReplacementMethodEnum FactorReplacementMethod
     81    {
     82      get { return FactorReplacementParameter.Value.Value; }
     83      set { FactorReplacementParameter.Value.Value = value; }
    8184    }
    8285    public DataPartitionEnum DataPartition
     
    98101      : base() {
    99102      Parameters.Add(new FixedValueParameter<EnumValue<ReplacementMethodEnum>>(ReplacementParameterName, "The replacement method for variables during impact calculation.", new EnumValue<ReplacementMethodEnum>(ReplacementMethodEnum.Median)));
     103      Parameters.Add(new FixedValueParameter<EnumValue<FactorReplacementMethodEnum>>(FactorReplacementParameterName, "The replacement method for factor variables during impact calculation.", new EnumValue<FactorReplacementMethodEnum>(FactorReplacementMethodEnum.Best)));
    100104      Parameters.Add(new FixedValueParameter<EnumValue<DataPartitionEnum>>(DataPartitionParameterName, "The data partition on which the impacts are calculated.", new EnumValue<DataPartitionEnum>(DataPartitionEnum.Training)));
    101105    }
     
    322326      IRegressionModel model, string variable, ModifiableDataset dataset,
    323327      IEnumerable<int> rows,
    324       FactorReplacementMethodEnum replacement = FactorReplacementMethodEnum.Shuffle) {
     328      FactorReplacementMethodEnum replacement = FactorReplacementMethodEnum.Best) {
    325329      var originalValues = dataset.GetReadOnlyStringValues(variable).ToList();
    326330      List<string> replacementValues;
Note: See TracChangeset for help on using the changeset viewer.