Ignore:
Timestamp:
10/29/15 19:48:17 (7 years ago)
Author:
gkronber
Message:

#1998

  • deleted obsolete version of OneR algorithm (also does perform worse than mkommend's implementation in my tests)
  • reused the ConstantRegressionModel as ConstantClassificationModel (OK?)
  • fixed a few strings here and there
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/ZeroR.cs

    r13086 r13089  
    3131  /// 0R classification algorithm.
    3232  /// </summary>
    33   [Item("ZeroR", "0R classification algorithm.")]
    34   [Creatable("Data Analysis")]
     33  [Item("ZeroR", "The simplest possible classifier, ZeroR always predicts the majority class.")]
     34  [Creatable("Data Analysis")] // TODO
    3535  [StorableClass]
    3636  public sealed class ZeroR : FixedDataAnalysisAlgorithm<IClassificationProblem> {
     
    5252    protected override void Run() {
    5353      var solution = CreateZeroRSolution(Problem.ProblemData);
    54       Results.Add(new Result("ZeroR solution", "The 0R classifier.", solution));
     54      Results.Add(new Result("ZeroR solution", "The simplest possible classifier, ZeroR always predicts the majority class.", solution));
    5555    }
    5656
     
    6060      var targetValues = dataset.GetDoubleValues(target, problemData.TrainingIndices);
    6161
     62
     63      // if multiple classes have the same number of observations then simply take the first one
    6264      var dominantClass = targetValues.GroupBy(x => x).ToDictionary(g => g.Key, g => g.Count())
    6365        .MaxItems(kvp => kvp.Value).Select(x => x.Key).First();
    6466
    65       var model = new ConstantClassificationModel(dominantClass);
     67      var model = new ConstantRegressionModel(dominantClass);
    6668      var solution = new ConstantClassificationSolution(model, (IClassificationProblemData)problemData.Clone());
    6769      return solution;
Note: See TracChangeset for help on using the changeset viewer.