Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/16 14:37:15 (8 years ago)
Author:
mkommend
Message:

#2604: Merged r13826,r13921, r13922, r13941, r13992, r13993, r14000 intos table.

Location:
stable
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.DataAnalysis

  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/BaselineClassifiers/OneR.cs

    r13092 r14027  
    139139      }
    140140
    141       var model = new OneRClassificationModel(bestVariable, bestSplits.Select(s => s.thresholdValue).ToArray(), bestSplits.Select(s => s.classValue).ToArray(), bestMissingValuesClass);
     141      var model = new OneRClassificationModel(problemData.TargetVariable, bestVariable, bestSplits.Select(s => s.thresholdValue).ToArray(), bestSplits.Select(s => s.classValue).ToArray(), bestMissingValuesClass);
    142142      var solution = new OneRClassificationSolution(model, (IClassificationProblemData)problemData.Clone());
    143143
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/BaselineClassifiers/OneRClassificationModel.cs

    r13098 r14027  
    3131  [StorableClass]
    3232  [Item("OneR Classification Model", "A model that uses intervals for one variable to determine the class.")]
    33   public class OneRClassificationModel : NamedItem, IClassificationModel {
     33  public class OneRClassificationModel : ClassificationModel {
     34    public override IEnumerable<string> VariablesUsedForPrediction {
     35      get { return new[] { Variable }; }
     36    }
     37
    3438    [Storable]
    3539    protected string variable;
     
    6670    public override IDeepCloneable Clone(Cloner cloner) { return new OneRClassificationModel(this, cloner); }
    6771
    68     public OneRClassificationModel(string variable, double[] splits, double[] classes, double missingValuesClass = double.NaN)
    69       : base() {
     72    public OneRClassificationModel(string targetVariable, string variable, double[] splits, double[] classes, double missingValuesClass = double.NaN)
     73      : base(targetVariable) {
    7074      if (splits.Length != classes.Length) {
    7175        throw new ArgumentException("Number of splits and classes has to be equal.");
     
    8488    // uses sorting to return the values in the order of rows, instead of using nested for loops
    8589    // to avoid O(n²) runtime
    86     public IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {
     90    public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {
    8791      var values = dataset.GetDoubleValues(Variable, rows).ToArray();
    8892      var rowsArray = rows.ToArray();
     
    108112    }
    109113
    110     public IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) {
     114    public override IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) {
    111115      return new OneRClassificationSolution(this, new ClassificationProblemData(problemData));
    112116    }
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/BaselineClassifiers/ZeroR.cs

    r13098 r14027  
    6464        .MaxItems(kvp => kvp.Value).Select(x => x.Key).First();
    6565
    66       var model = new ConstantModel(dominantClass);
     66      var model = new ConstantModel(dominantClass, target);
    6767      var solution = model.CreateClassificationSolution(problemData);
    6868      return solution;
Note: See TracChangeset for help on using the changeset viewer.