Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12448


Ignore:
Timestamp:
06/15/15 17:00:37 (9 years ago)
Author:
ehopf
Message:

#2361: Minor naming changes.

Location:
branches/SensitivityEvaluator
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs

    r12416 r12448  
    3232namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    3333  [Item("Weighted Residuals Mean Squared Error Evaluator", @"A modified mean squared error evaluator that enables the possibility to weight residuals differently.
    34 The first residual category belongs to estimated values which obviously belong to a specific class because the estimated value is located above the maximum or below the minimum of all the class values (ObviousResidualsWeight).
     34The first residual category belongs to estimated values which definitely belong to a specific class because the estimated value is located above the maximum or below the minimum of all the class values (DefiniteResidualsWeight).
    3535The second residual category represents residuals which belong to the positive class whereby the estimated value is located between the positive and a negative class (PositiveClassResidualsWeight).
    36 All other cases are represented by the third category (NegativeClassResidualsWeight).
     36All other cases are represented by the third category (NegativeClassesResidualsWeight).
    3737The weight is multiplied to the error before squaring which means that the Evaluator acts like a normal MSE-Evaluator if all the weights are set to 1.")]
    3838  [StorableClass]
    3939  public class SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
    40     private const string ObviousResidualsWeightParameterName = "ObviousResidualsWeight";
     40    private const string DefiniteResidualsWeightParameterName = "DefiniteResidualsWeight";
    4141    private const string PositiveClassResidualsWeightParameterName = "PositiveClassResidualsWeight";
    42     private const string NegativeClassResidualsWeightParameterName = "NegativeClassResidualsWeight";
     42    private const string NegativeClassesResidualsWeightParameterName = "NegativeClassesResidualsWeight";
    4343    [StorableConstructor]
    4444    protected SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     
    5252    public SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator()
    5353      : base() {
    54       Parameters.Add(new FixedValueParameter<DoubleValue>(ObviousResidualsWeightParameterName, "Weight of residuals which obviously belong to a specific class because the estimated values is located above the maximum or below the minimum of all the class values.", new DoubleValue(1)));
     54      Parameters.Add(new FixedValueParameter<DoubleValue>(DefiniteResidualsWeightParameterName, "Weight of residuals which definitely belong to a specific class because the estimated values is located above the maximum or below the minimum of all the class values.", new DoubleValue(1)));
    5555      Parameters.Add(new FixedValueParameter<DoubleValue>(PositiveClassResidualsWeightParameterName, "Weight of residuals which belong to the positive class whereby the estimated value is located between the positive and a negative class.", new DoubleValue(1)));
    56       Parameters.Add(new FixedValueParameter<DoubleValue>(NegativeClassResidualsWeightParameterName, "Weight of residuals which are not covered by the ObviousResidualsWeight or the PositiveClassResidualsWeight.", new DoubleValue(1)));
     56      Parameters.Add(new FixedValueParameter<DoubleValue>(NegativeClassesResidualsWeightParameterName, "Weight of residuals which are not covered by the DefiniteResidualsWeight or the PositiveClassResidualsWeight.", new DoubleValue(1)));
    5757    }
    5858
    5959    #region parameter properties
    60     public IFixedValueParameter<DoubleValue> ObviousResidualsWeightParameter {
    61       get { return (IFixedValueParameter<DoubleValue>)Parameters[ObviousResidualsWeightParameterName]; }
     60    public IFixedValueParameter<DoubleValue> DefiniteResidualsWeightParameter {
     61      get { return (IFixedValueParameter<DoubleValue>)Parameters[DefiniteResidualsWeightParameterName]; }
    6262    }
    6363    public IFixedValueParameter<DoubleValue> PositiveClassResidualsWeightParameter {
    6464      get { return (IFixedValueParameter<DoubleValue>)Parameters[PositiveClassResidualsWeightParameterName]; }
    6565    }
    66     public IFixedValueParameter<DoubleValue> NegativeClassResidualsWeightParameter {
    67       get { return (IFixedValueParameter<DoubleValue>)Parameters[NegativeClassResidualsWeightParameterName]; }
     66    public IFixedValueParameter<DoubleValue> NegativeClassesResidualsWeightParameter {
     67      get { return (IFixedValueParameter<DoubleValue>)Parameters[NegativeClassesResidualsWeightParameterName]; }
    6868    }
    6969    #endregion
     
    7272    public override bool Maximization { get { return false; } }
    7373
    74     public double ObviousResidualsWeight {
     74    public double DefiniteResidualsWeight {
    7575      get {
    76         return ObviousResidualsWeightParameter.Value.Value;
     76        return DefiniteResidualsWeightParameter.Value.Value;
    7777      }
    7878    }
     
    8282      }
    8383    }
    84     public double NegativeClassResidualsWeight {
     84    public double NegativeClassesResidualsWeight {
    8585      get {
    86         return NegativeClassResidualsWeightParameter.Value.Value;
     86        return NegativeClassesResidualsWeightParameter.Value.Value;
    8787      }
    8888    }
     
    9393      var solution = SymbolicExpressionTreeParameter.ActualValue;
    9494      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows, ApplyLinearScalingParameter.ActualValue.Value,
    95         ObviousResidualsWeight, PositiveClassResidualsWeight, NegativeClassResidualsWeight);
     95        DefiniteResidualsWeight, PositiveClassResidualsWeight, NegativeClassesResidualsWeight);
    9696      QualityParameter.ActualValue = new DoubleValue(quality);
    9797      return base.InstrumentedApply();
     
    9999
    100100    public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, IClassificationProblemData problemData, IEnumerable<int> rows, bool applyLinearScaling,
    101       double obviousResidualsWeight, double positiveClassResidualsWeight, double negativeClassResidualsWeight) {
     101      double definiteResidualsWeight, double positiveClassResidualsWeight, double negativeClassesResidualsWeight) {
    102102      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows);
    103103      IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
     
    116116      if (applyLinearScaling) {
    117117        var calculator = new OnlineWeightedResidualsMeanSquaredErrorCalculator(positiveClassValue, classValuesMax, classValuesMin,
    118           obviousResidualsWeight, positiveClassResidualsWeight, negativeClassResidualsWeight);
     118          definiteResidualsWeight, positiveClassResidualsWeight, negativeClassesResidualsWeight);
    119119        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, calculator, problemData.Dataset.Rows);
    120120        errorState = calculator.ErrorState;
     
    123123        IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
    124124        quality = OnlineWeightedResidualsMeanSquaredErrorCalculator.Calculate(targetValues, boundedEstimatedValues, positiveClassValue, classValuesMax,
    125           classValuesMin, obviousResidualsWeight, positiveClassResidualsWeight, negativeClassResidualsWeight, out errorState);
     125          classValuesMin, definiteResidualsWeight, positiveClassResidualsWeight, negativeClassesResidualsWeight, out errorState);
    126126      }
    127127      if (errorState != OnlineCalculatorError.None) return Double.NaN;
     
    134134      ApplyLinearScalingParameter.ExecutionContext = context;
    135135
    136       double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, ObviousResidualsWeight, PositiveClassResidualsWeight, NegativeClassResidualsWeight);
     136      double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, ApplyLinearScalingParameter.ActualValue.Value, DefiniteResidualsWeight, PositiveClassResidualsWeight, NegativeClassesResidualsWeight);
    137137
    138138      SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null;
  • branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineWeightedResidualsMeanSquaredErrorCalculator.cs

    r12416 r12448  
    3636
    3737    public double PositiveClassValue { get; private set; }
    38     public double ClassValueMax { get; private set; }
    39     public double ClassValueMin { get; private set; }
    40     public double ObviousResidualsWeight { get; private set; }
     38    public double ClassValuesMax { get; private set; }
     39    public double ClassValuesMin { get; private set; }
     40    public double DefiniteResidualsWeight { get; private set; }
    4141    public double PositiveClassResidualsWeight { get; private set; }
    42     public double NegativeClassResidualsWeight { get; private set; }
     42    public double NegativeClassesResidualsWeight { get; private set; }
    4343
    44     public OnlineWeightedResidualsMeanSquaredErrorCalculator(double positiveClassValue, double classValueMax, double classValueMin,
    45                                                                 double obviousResidualsWeight, double positiveClassResidualsWeight, double negativeClassResidualsWeight) {
     44    public OnlineWeightedResidualsMeanSquaredErrorCalculator(double positiveClassValue, double classValuesMax, double classValuesMin,
     45                                                                double definiteResidualsWeight, double positiveClassResidualsWeight, double negativeClassesResidualsWeight) {
    4646      PositiveClassValue = positiveClassValue;
    47       ClassValueMax = classValueMax;
    48       ClassValueMin = classValueMin;
    49       ObviousResidualsWeight = obviousResidualsWeight;
     47      ClassValuesMax = classValuesMax;
     48      ClassValuesMin = classValuesMin;
     49      DefiniteResidualsWeight = definiteResidualsWeight;
    5050      PositiveClassResidualsWeight = positiveClassResidualsWeight;
    51       NegativeClassResidualsWeight = negativeClassResidualsWeight;
     51      NegativeClassesResidualsWeight = negativeClassesResidualsWeight;
    5252      Reset();
    5353    }
     
    7575        double weight;
    7676        //apply weight
    77         if (estimated > ClassValueMax || estimated < ClassValueMin) {
    78           weight = ObviousResidualsWeight;
    79         } else if (original.IsAlmost(PositiveClassValue))
    80         {
     77        if (estimated > ClassValuesMax || estimated < ClassValuesMin) {
     78          weight = DefiniteResidualsWeight;
     79        } else if (original.IsAlmost(PositiveClassValue)) {
    8180          weight = PositiveClassResidualsWeight;
    82         } else
    83         {
    84           weight = NegativeClassResidualsWeight;
     81        } else {
     82          weight = NegativeClassesResidualsWeight;
    8583        }
    8684        error *= weight;
     
    9290    #endregion
    9391
    94     public static double Calculate(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues, double positiveClassValue, double classValueMax, double classValueMin,
    95                                                                 double obviousValuesWeight, double positiveClassValuesWeight, double negativeClassValuesWeight, out OnlineCalculatorError errorState) {
     92    public static double Calculate(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues, double positiveClassValue, double classValuesMax, double classValuesMin,
     93                                                                double definiteResidualsWeight, double positiveClassResidualsWeight, double negativeClassesResidualsWeight, out OnlineCalculatorError errorState) {
    9694      IEnumerator<double> originalEnumerator = originalValues.GetEnumerator();
    9795      IEnumerator<double> estimatedEnumerator = estimatedValues.GetEnumerator();
    98       OnlineWeightedResidualsMeanSquaredErrorCalculator calculator = new OnlineWeightedResidualsMeanSquaredErrorCalculator(positiveClassValue, classValueMax, classValueMin, obviousValuesWeight, positiveClassValuesWeight, negativeClassValuesWeight);
     96      OnlineWeightedResidualsMeanSquaredErrorCalculator calculator = new OnlineWeightedResidualsMeanSquaredErrorCalculator(positiveClassValue, classValuesMax, classValuesMin, definiteResidualsWeight, positiveClassResidualsWeight, negativeClassesResidualsWeight);
    9997
    10098      // always move forward both enumerators (do not use short-circuit evaluation!)
Note: See TracChangeset for help on using the changeset viewer.