Changeset 17081


Ignore:
Timestamp:
07/05/19 11:14:32 (2 weeks ago)
Author:
gkronber
Message:

#2847: more changes for renaming the M5 plugin

Location:
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/DecisionTreeRegression.cs

    r17080 r17081  
    145145      Parameters.Add(new FixedValueParameter<BoolValue>(GenerateRulesParameterName, "Whether a set of rules or a decision tree shall be created (default=false)", new BoolValue(false)));
    146146      Parameters.Add(new FixedValueParameter<PercentValue>(HoldoutSizeParameterName, "How much of the training set shall be reserved for pruning (default=20%).", new PercentValue(0.2)));
    147       Parameters.Add(new ConstrainedValueParameter<ISplitter>(SplitterParameterName, "The type of split function used to create node splits (default='Splitter').", splitterSet, splitterSet.OfType<M5Splitter>().First()));
     147      Parameters.Add(new ConstrainedValueParameter<ISplitter>(SplitterParameterName, "The type of split function used to create node splits (default='Splitter').", splitterSet, splitterSet.OfType<Splitter>().First()));
    148148      Parameters.Add(new FixedValueParameter<IntValue>(MinimalNodeSizeParameterName, "The minimal number of samples in a leaf node (default=1).", new IntValue(1)));
    149149      Parameters.Add(new ConstrainedValueParameter<ILeafModel>(LeafModelParameterName, "The type of model used for the nodes (default='LinearLeaf').", modelSet, modelSet.OfType<LinearLeaf>().First()));
     
    178178      bool useHoldout = false, double holdoutSize = 0.2, int minimumLeafSize = 1, bool generateRules = false, ResultCollection results = null, CancellationToken? cancellationToken = null) {
    179179      if (leafModel == null) leafModel = new LinearLeaf();
    180       if (splitter == null) splitter = new M5Splitter();
     180      if (splitter == null) splitter = new Splitter();
    181181      if (cancellationToken == null) cancellationToken = CancellationToken.None;
    182182      if (pruning == null) pruning = new ComplexityPruning();
     
    187187    }
    188188
    189     public static void UpdateModel(IM5Model model, IRegressionProblemData problemData, IRandom random, ILeafModel leafModel, CancellationToken? cancellationToken = null) {
     189    public static void UpdateModel(IDecisionTreeModel model, IRegressionProblemData problemData, IRandom random, ILeafModel leafModel, CancellationToken? cancellationToken = null) {
    190190      if (cancellationToken == null) cancellationToken = CancellationToken.None;
    191191      var regressionTreeParameters = new RegressionTreeParameters(leafModel, problemData, random);
     
    244244    private static IRegressionModel Build(IScope stateScope, ResultCollection results, CancellationToken cancellationToken) {
    245245      var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[RegressionTreeParameterVariableName].Value;
    246       var model = (IM5Model)stateScope.Variables[ModelVariableName].Value;
     246      var model = (IDecisionTreeModel)stateScope.Variables[ModelVariableName].Value;
    247247      var trainingRows = (IntArray)stateScope.Variables[TrainingSetVariableName].Value;
    248248      var pruningRows = (IntArray)stateScope.Variables[PruningSetVariableName].Value;
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/Interfaces/IDecisionTreeModel.cs

    r17080 r17081  
    2929namespace HeuristicLab.Algorithms.DataAnalysis {
    3030  [StorableType("A5399E6A-6A4D-4616-A1CD-CE12FE670F12")]
    31   public interface IM5Model : IRegressionModel {
     31  public interface IDecisionTreeModel : IRegressionModel {
    3232    void Build(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope stateScope, ResultCollection results, CancellationToken cancellationToken);
    3333    void Update(IReadOnlyList<int> rows, IScope stateScope, CancellationToken cancellationToken);
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/LeafModels/DampenedModel.cs

    r16847 r17081  
    2828
    2929namespace HeuristicLab.Algorithms.DataAnalysis {
    30   //mulitdimensional extension of http://www2.stat.duke.edu/~tjl13/s101/slides/unit6lec3H.pdf
     30  // mulitdimensional extension of http://www2.stat.duke.edu/~tjl13/s101/slides/unit6lec3H.pdf
    3131  [StorableType("42E9766F-207F-47B1-890C-D5DFCF469838")]
    3232  public class DampenedModel : RegressionModel {
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/LeafTypes/Leaf.cs

    r17080 r17081  
    3131namespace HeuristicLab.Algorithms.DataAnalysis {
    3232  [StorableType("58517042-5318-4087-B098-AC75F0208BA0")]
    33   [Item("M5Leaf", "A leaf type that uses regularized linear models with feature selection as leaf models.")]
    34   public sealed class M5Leaf : LeafBase {
     33  [Item("Leaf", "A leaf type that uses regularized linear models with feature selection as leaf models.")]
     34  public sealed class Leaf : LeafBase {
    3535    #region Constructors & Cloning
    3636    [StorableConstructor]
    37     private M5Leaf(StorableConstructorFlag _) : base(_) { }
    38     private M5Leaf(M5Leaf original, Cloner cloner) : base(original, cloner) { }
    39     public M5Leaf() { }
     37    private Leaf(StorableConstructorFlag _) : base(_) { }
     38    private Leaf(Leaf original, Cloner cloner) : base(original, cloner) { }
     39    public Leaf() { }
    4040    public override IDeepCloneable Clone(Cloner cloner) {
    41       return new M5Leaf(this, cloner);
     41      return new Leaf(this, cloner);
    4242    }
    4343    #endregion
     
    4848    }
    4949    public override IRegressionModel Build(IRegressionProblemData pd, IRandom random, CancellationToken cancellationToken, out int numberOfParameters) {
    50       if (pd.Dataset.Rows == 0) throw new ArgumentException("The number of training instances is too small to create an M5 leaf model");
     50      if (pd.Dataset.Rows == 0) throw new ArgumentException("The number of training instances is too small to create a leaf model");
    5151
    5252      if (pd.Dataset.Rows == 1)
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/LeafTypes/RegularizedLeaf.cs

    r17080 r17081  
    3131namespace HeuristicLab.Algorithms.DataAnalysis {
    3232  [StorableType("0AED959D-78C3-4927-BDCF-473D0AEE32AA")]
    33   [Item("M5regLeaf", "A leaf type that uses regularized linear models as leaf models.")]
    34   public sealed class M5regLeaf : LeafBase {
     33  [Item("RegularizedLeaf", "A leaf type that uses regularized linear models as leaf models.")]
     34  public sealed class RegularizedLeaf : LeafBase {
    3535    #region Constructors & Cloning
    3636    [StorableConstructor]
    37     private M5regLeaf(StorableConstructorFlag _) : base(_) { }
    38     private M5regLeaf(M5regLeaf original, Cloner cloner) : base(original, cloner) { }
    39     public M5regLeaf() { }
     37    private RegularizedLeaf(StorableConstructorFlag _) : base(_) { }
     38    private RegularizedLeaf(RegularizedLeaf original, Cloner cloner) : base(original, cloner) { }
     39    public RegularizedLeaf() { }
    4040    public override IDeepCloneable Clone(Cloner cloner) {
    41       return new M5regLeaf(this, cloner);
     41      return new RegularizedLeaf(this, cloner);
    4242    }
    4343    #endregion
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/MetaModels/RegressionNodeTreeModel.cs

    r17080 r17081  
    3232namespace HeuristicLab.Algorithms.DataAnalysis {
    3333  [StorableType("FAF1F955-82F3-4824-9759-9D2846E831AE")]
    34   public class RegressionNodeTreeModel : RegressionModel, IM5Model {
     34  public class RegressionNodeTreeModel : RegressionModel, IDecisionTreeModel {
    3535    public const string NumCurrentLeafsResultName = "Number of current leafs";
    3636    public const string RootVariableName = "Root";
     
    6969    #endregion
    7070
    71     #region IM5Model
     71    #region IDecisionTreeModel
    7272    public void Build(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope statescope, ResultCollection results, CancellationToken cancellationToken) {
    7373      var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/MetaModels/RegressionRuleModel.cs

    r17080 r17081  
    3333namespace HeuristicLab.Algorithms.DataAnalysis {
    3434  [StorableType("425AF262-A756-4E9A-B76F-4D2480BEA4FD")]
    35   public class RegressionRuleModel : RegressionModel, IM5Model {
     35  public class RegressionRuleModel : RegressionModel, IDecisionTreeModel {
    3636    #region Properties
    3737    [Storable]
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/MetaModels/RegressionRuleSetModel.cs

    r17080 r17081  
    3333namespace HeuristicLab.Algorithms.DataAnalysis {
    3434  [StorableType("7B4D9AE9-0456-4029-80A6-CCB5E33CE356")]
    35   public class RegressionRuleSetModel : RegressionModel, IM5Model {
     35  public class RegressionRuleSetModel : RegressionModel, IDecisionTreeModel {
    3636    private const string NumRulesResultName = "Number of rules";
    3737    private const string CoveredInstancesResultName = "Covered instances";
     
    7575    #endregion
    7676
    77     #region IM5Model
     77    #region IDecisionTreeModel
    7878    public void Build(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope stateScope, ResultCollection results, CancellationToken cancellationToken) {
    7979      var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value;
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/Properties/AssemblyInfo.cs.frame

    r16855 r17081  
    2828// set of attributes. Change these attribute values to modify the information
    2929// associated with an assembly.
    30 [assembly: AssemblyTitle("HeuristicLab.Algorithms.DataAnalysis.M5")]
    31 [assembly: AssemblyDescription("Provides the M5' regression algorithm")]
     30[assembly: AssemblyTitle("HeuristicLab.Algorithms.DataAnalysis.DecisionTrees")]
     31[assembly: AssemblyDescription("Provides algorithms for learning decision trees for regression.")]
    3232[assembly: AssemblyConfiguration("")]
    3333[assembly: AssemblyCompany("")]
  • trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/Splitting/Splitter.cs

    r17080 r17081  
    3131  [StorableType("502B1429-7A28-45C1-A60A-93E72CB3AF4A")]
    3232  [Item("Splitter", "A split selector that uses the ratio between Variances^(1/Order) to determine good splits.")]
    33   public sealed class M5Splitter : SplitterBase {
     33  public sealed class Splitter : SplitterBase {
    3434    public const string OrderParameterName = "Order";
    3535    public IFixedValueParameter<DoubleValue> OrderParameter {
     
    4343    #region Constructors & Cloning
    4444    [StorableConstructor]
    45     private M5Splitter(StorableConstructorFlag _) { }
    46     private M5Splitter(M5Splitter original, Cloner cloner) : base(original, cloner) { }
    47     public M5Splitter() {
     45    private Splitter(StorableConstructorFlag _) { }
     46    private Splitter(Splitter original, Cloner cloner) : base(original, cloner) { }
     47    public Splitter() {
    4848      Parameters.Add(new FixedValueParameter<DoubleValue>(OrderParameterName, "The exponent in the split calculation sum (x_i - x_avg)^Order (default=5).", new DoubleValue(5)));
    4949    }
    5050    public override IDeepCloneable Clone(Cloner cloner) {
    51       return new M5Splitter(this, cloner);
     51      return new Splitter(this, cloner);
    5252    }
    5353    #endregion
Note: See TracChangeset for help on using the changeset viewer.