Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13089


Ignore:
Timestamp:
10/29/15 19:48:17 (8 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
Location:
branches/ClassificationModelComparison
Files:
2 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj

    r13085 r13089  
    318318    <Compile Include="Linear\AlglibUtil.cs" />
    319319    <Compile Include="Linear\OneRTest.cs" />
    320     <Compile Include="Linear\OneR.cs" />
    321320    <Compile Include="Linear\OneR\OneRClassificationModel.cs" />
    322321    <Compile Include="Linear\OneR\OneRClassificationSolution.cs" />
  • branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/OneRTest.cs

    r10570 r13089  
    3434  /// 1R classification algorithm.
    3535  /// </summary>
    36   [Item("OneR Classification", "1R classification algorithm.")]
     36  [Item("OneR Classification", "A simple classification algorithm the searches the best single-variable split (does not support categorical features correctly).")]
    3737  [StorableClass]
    3838  public sealed class OneRTest : FixedDataAnalysisAlgorithm<IClassificationProblem> {
     
    6363    }
    6464
    65     public static IClassificationSolution CreateOneRSolution(IClassificationProblemData problemData, int minBucketSize) {
     65    public static IClassificationSolution CreateOneRSolution(IClassificationProblemData problemData, int minBucketSize = 6) {
    6666      var bestClassified = 0;
    6767      List<Split> bestSplits = null;
  • 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;
  • branches/ClassificationModelComparison/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionComparisonView.cs

    r13086 r13089  
    8787          dataGridView.ColumnCount = 4;
    8888          dataGridView.RowCount = solutions.Count();
    89           dataGridView.Columns[0].HeaderText = "Training Accuracy";
    90           dataGridView.Columns[1].HeaderText = "Test Accuracy";
    91           dataGridView.Columns[2].HeaderText = "Matthews Correlation Coefficient Training";
    92           dataGridView.Columns[3].HeaderText = "Matthews Correlation Coefficient Test";
     89          dataGridView.Columns[0].HeaderText = "Accuracy (training)";
     90          dataGridView.Columns[1].HeaderText = "Accuracy (test)";
     91          dataGridView.Columns[2].HeaderText = "Matthews Correlation Coefficient (training)";
     92          dataGridView.Columns[3].HeaderText = "Matthews Correlation Coefficient (test)";
    9393          if (problemData.Classes == 2) {
    9494            dataGridView.ColumnCount = 6;
    95             dataGridView.Columns[4].HeaderText = "F1 Score Training";
    96             dataGridView.Columns[5].HeaderText = "F1 Score Test";
     95            dataGridView.Columns[4].HeaderText = "F1 Score (training)";
     96            dataGridView.Columns[5].HeaderText = "F1 Score (test)";
    9797          }
    9898
     
    130130      var newSolutions = new List<IClassificationSolution>();
    131131      var zeroR = ZeroR.CreateZeroRSolution(problemData);
    132       zeroR.Name = "0R Classification Solution";
     132      zeroR.Name = "ZeroR Classification Solution";
    133133      newSolutions.Add(zeroR);
    134       var oneR = OneR.CreateOneRSolution(problemData, 6, new FastRandom());
    135       oneR.Name = "1R Classification Solution";
     134      var oneR = OneRTest.CreateOneRSolution(problemData);
     135      oneR.Name = "OneR Classification Solution";
    136136      newSolutions.Add(oneR);
    137137      try {
  • branches/ClassificationModelComparison/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r13083 r13089  
    172172    <Compile Include="Implementation\Classification\ConstantClassificationSolution.cs" />
    173173    <Compile Include="Implementation\Classification\DiscriminantFunctionClassificationSolutionBase.cs" />
    174     <Compile Include="Implementation\Classification\ConstantClassificationModel.cs" />
    175174    <Compile Include="Implementation\Clustering\ClusteringProblem.cs" />
    176175    <Compile Include="Implementation\Clustering\ClusteringProblemData.cs" />
  • branches/ClassificationModelComparison/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ConstantClassificationSolution.cs

    r9119 r13089  
    2828  [Item(Name = "Constant Classification Solution", Description = "Represents a constant classification solution (model + data).")]
    2929  public class ConstantClassificationSolution : ClassificationSolution {
    30     public new ConstantClassificationModel Model {
    31       get { return (ConstantClassificationModel)base.Model; }
     30    public new ConstantRegressionModel Model {
     31      get { return (ConstantRegressionModel)base.Model; }
    3232      set { base.Model = value; }
    3333    }
     
    3636    protected ConstantClassificationSolution(bool deserializing) : base(deserializing) { }
    3737    protected ConstantClassificationSolution(ConstantClassificationSolution original, Cloner cloner) : base(original, cloner) { }
    38     public ConstantClassificationSolution(ConstantClassificationModel model, IClassificationProblemData problemData)
     38    public ConstantClassificationSolution(ConstantRegressionModel model, IClassificationProblemData problemData)
    3939      : base(model, problemData) {
    4040      RecalculateResults();
  • branches/ClassificationModelComparison/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ConstantRegressionModel.cs

    r13083 r13089  
    3030namespace HeuristicLab.Problems.DataAnalysis {
    3131  [StorableClass]
    32   [Item("Constant Regression Model", "A model that always returns the same constant value regardless of the presented input data.")]
    33   public class ConstantRegressionModel : NamedItem, IRegressionModel, IStringConvertibleValue {
     32  [Item("Constant Model", "A model that always returns the same constant value regardless of the presented input data.")]
     33  // TODO this class should be renamed, since it is also used to handle the classification case now
     34  public class ConstantRegressionModel : NamedItem, IRegressionModel, IClassificationModel, IStringConvertibleValue {
    3435    [Storable]
    3536    private double constant;
     
    5960    }
    6061
     62    public IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {
     63      return GetEstimatedValues(dataset, rows);
     64    }
     65
    6166    public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
    6267      return new ConstantRegressionSolution(this, new RegressionProblemData(problemData));
     68    }
     69
     70    public IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) {
     71      return new ConstantClassificationSolution(this, new ClassificationProblemData(problemData));
    6372    }
    6473
     
    7079    public bool ReadOnly { get; private set; }
    7180    public bool Validate(string value, out string errorMessage) {
    72       throw new NotSupportedException(); // changing a constant regression model is not supported
     81      throw new NotSupportedException(); // changing a constant model is not supported
    7382    }
    7483
     
    7887
    7988    public bool SetValue(string value) {
    80       throw new NotSupportedException(); // changing a constant regression model is not supported
     89      throw new NotSupportedException(); // changing a constant model is not supported
    8190    }
    8291
    8392    public event EventHandler ValueChanged;
    8493    #endregion
     94
    8595  }
    8696}
Note: See TracChangeset for help on using the changeset viewer.