Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8550


Ignore:
Timestamp:
08/31/12 13:52:24 (12 years ago)
Author:
mkommend
Message:

#1919: Changed threshold calculation methods to instance instead of static methods.

Location:
trunk/sources
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs

    r8531 r8550  
    112112      IEnumerable<int> rows) {
    113113      var model = new SymbolicDiscriminantFunctionClassificationModel(tree, interpreter);
    114       SymbolicDiscriminantFunctionClassificationModel.SetAccuracyMaximizingThresholds(model, problemData);
     114      model.SetAccuracyMaximizingThresholds(problemData);
    115115      return model;
    116116    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/InteractiveSymbolicDiscriminantFunctionClassificationSolutionSimplifierView.cs

    r8531 r8550  
    5555      // However, since we automatically prune sub-trees based on the threshold reaching the maximum accuracy we must
    5656      // also use maximum accuracy threshold calculation here in order to prevent incoherent behavior of the simplifier.
    57       SymbolicDiscriminantFunctionClassificationModel.SetAccuracyMaximizingThresholds(model, Content.ProblemData);
     57      model.SetAccuracyMaximizingThresholds(Content.ProblemData);
    5858      Content.Model = model;
    5959    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r8531 r8550  
    7979      if (ApplyLinearScaling.Value) SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    8080
    81       SymbolicDiscriminantFunctionClassificationModel.SetAccuracyMaximizingThresholds(model, ProblemDataParameter.ActualValue);
     81      model.SetAccuracyMaximizingThresholds(ProblemDataParameter.ActualValue);
    8282      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    8383    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs

    r8531 r8550  
    6868      if (ApplyLinearScaling.Value) SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    6969
    70       SymbolicDiscriminantFunctionClassificationModel.SetAccuracyMaximizingThresholds(model, ProblemDataParameter.ActualValue);
     70      model.SetAccuracyMaximizingThresholds(ProblemDataParameter.ActualValue);
    7171      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    7272    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r8531 r8550  
    7777      if (ApplyLinearScaling.Value) SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    7878
    79       SymbolicDiscriminantFunctionClassificationModel.SetAccuracyMaximizingThresholds(model, ProblemDataParameter.ActualValue);
     79      model.SetAccuracyMaximizingThresholds(ProblemDataParameter.ActualValue);
    8080      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    8181    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs

    r8531 r8550  
    6262      if (ApplyLinearScaling.Value) SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    6363
    64       SymbolicDiscriminantFunctionClassificationModel.SetAccuracyMaximizingThresholds(model, ProblemDataParameter.ActualValue);
     64      model.SetAccuracyMaximizingThresholds(ProblemDataParameter.ActualValue);
    6565      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    6666    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs

    r8531 r8550  
    6868      if (ApplyLinearScaling.Value) SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    6969
    70       SymbolicDiscriminantFunctionClassificationModel.SetAccuracyMaximizingThresholds(model, ProblemDataParameter.ActualValue);
     70      model.SetAccuracyMaximizingThresholds(ProblemDataParameter.ActualValue);
    7171      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    7272    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer.cs

    r8531 r8550  
    6262      if (ApplyLinearScaling.Value) SymbolicDiscriminantFunctionClassificationModel.Scale(model, ProblemDataParameter.ActualValue);
    6363
    64       SymbolicDiscriminantFunctionClassificationModel.SetAccuracyMaximizingThresholds(model, ProblemDataParameter.ActualValue);
     64      model.SetAccuracyMaximizingThresholds(ProblemDataParameter.ActualValue);
    6565      return new SymbolicDiscriminantFunctionClassificationSolution(model, (IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    6666    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs

    r8533 r8550  
    122122    #endregion
    123123
    124     public static void SetAccuracyMaximizingThresholds(IDiscriminantFunctionClassificationModel model, IClassificationProblemData problemData) {
     124    public void SetAccuracyMaximizingThresholds(IClassificationProblemData problemData) {
    125125      double[] classValues;
    126126      double[] thresholds;
    127127      var targetClassValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices);
    128       var estimatedTrainingValues = model.GetEstimatedValues(problemData.Dataset, problemData.TrainingIndices);
     128      var estimatedTrainingValues = GetEstimatedValues(problemData.Dataset, problemData.TrainingIndices);
    129129      AccuracyMaximizationThresholdCalculator.CalculateThresholds(problemData, estimatedTrainingValues, targetClassValues, out classValues, out thresholds);
    130130
    131       model.SetThresholdsAndClassValues(thresholds, classValues);
    132     }
    133 
    134     public static void SetClassDistributionCutPointThresholds(IDiscriminantFunctionClassificationModel model, IClassificationProblemData problemData) {
     131      SetThresholdsAndClassValues(thresholds, classValues);
     132    }
     133
     134    public void SetClassDistributionCutPointThresholds(IClassificationProblemData problemData) {
    135135      double[] classValues;
    136136      double[] thresholds;
    137137      var targetClassValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices);
    138       var estimatedTrainingValues = model.GetEstimatedValues(problemData.Dataset, problemData.TrainingIndices);
     138      var estimatedTrainingValues = GetEstimatedValues(problemData.Dataset, problemData.TrainingIndices);
    139139      NormalDistributionCutPointsThresholdCalculator.CalculateThresholds(problemData, estimatedTrainingValues, targetClassValues, out classValues, out thresholds);
    140140
    141       model.SetThresholdsAndClassValues(thresholds, classValues);
     141      SetThresholdsAndClassValues(thresholds, classValues);
    142142    }
    143143
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionThresholdView.cs

    r8139 r8550  
    238238      double[] thresholds = Content.Model.Thresholds.ToArray();
    239239      thresholds[classIndex] = e.NewLocationY;
     240      Array.Sort(thresholds);
    240241      Content.Model.SetThresholdsAndClassValues(thresholds, Content.Model.ClassValues);
    241242    }
Note: See TracChangeset for help on using the changeset viewer.