- Timestamp:
- 07/05/19 11:14:32 (5 years ago)
- 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 145 145 Parameters.Add(new FixedValueParameter<BoolValue>(GenerateRulesParameterName, "Whether a set of rules or a decision tree shall be created (default=false)", new BoolValue(false))); 146 146 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())); 148 148 Parameters.Add(new FixedValueParameter<IntValue>(MinimalNodeSizeParameterName, "The minimal number of samples in a leaf node (default=1).", new IntValue(1))); 149 149 Parameters.Add(new ConstrainedValueParameter<ILeafModel>(LeafModelParameterName, "The type of model used for the nodes (default='LinearLeaf').", modelSet, modelSet.OfType<LinearLeaf>().First())); … … 178 178 bool useHoldout = false, double holdoutSize = 0.2, int minimumLeafSize = 1, bool generateRules = false, ResultCollection results = null, CancellationToken? cancellationToken = null) { 179 179 if (leafModel == null) leafModel = new LinearLeaf(); 180 if (splitter == null) splitter = new M5Splitter();180 if (splitter == null) splitter = new Splitter(); 181 181 if (cancellationToken == null) cancellationToken = CancellationToken.None; 182 182 if (pruning == null) pruning = new ComplexityPruning(); … … 187 187 } 188 188 189 public static void UpdateModel(I M5Model 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) { 190 190 if (cancellationToken == null) cancellationToken = CancellationToken.None; 191 191 var regressionTreeParameters = new RegressionTreeParameters(leafModel, problemData, random); … … 244 244 private static IRegressionModel Build(IScope stateScope, ResultCollection results, CancellationToken cancellationToken) { 245 245 var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[RegressionTreeParameterVariableName].Value; 246 var model = (I M5Model)stateScope.Variables[ModelVariableName].Value;246 var model = (IDecisionTreeModel)stateScope.Variables[ModelVariableName].Value; 247 247 var trainingRows = (IntArray)stateScope.Variables[TrainingSetVariableName].Value; 248 248 var pruningRows = (IntArray)stateScope.Variables[PruningSetVariableName].Value; -
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/Interfaces/IDecisionTreeModel.cs
r17080 r17081 29 29 namespace HeuristicLab.Algorithms.DataAnalysis { 30 30 [StorableType("A5399E6A-6A4D-4616-A1CD-CE12FE670F12")] 31 public interface I M5Model : IRegressionModel {31 public interface IDecisionTreeModel : IRegressionModel { 32 32 void Build(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope stateScope, ResultCollection results, CancellationToken cancellationToken); 33 33 void Update(IReadOnlyList<int> rows, IScope stateScope, CancellationToken cancellationToken); -
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/LeafModels/DampenedModel.cs
r16847 r17081 28 28 29 29 namespace HeuristicLab.Algorithms.DataAnalysis { 30 // mulitdimensional extension of http://www2.stat.duke.edu/~tjl13/s101/slides/unit6lec3H.pdf30 // mulitdimensional extension of http://www2.stat.duke.edu/~tjl13/s101/slides/unit6lec3H.pdf 31 31 [StorableType("42E9766F-207F-47B1-890C-D5DFCF469838")] 32 32 public class DampenedModel : RegressionModel { -
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/LeafTypes/Leaf.cs
r17080 r17081 31 31 namespace HeuristicLab.Algorithms.DataAnalysis { 32 32 [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 { 35 35 #region Constructors & Cloning 36 36 [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() { } 40 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new M5Leaf(this, cloner);41 return new Leaf(this, cloner); 42 42 } 43 43 #endregion … … 48 48 } 49 49 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 a n M5leaf model");50 if (pd.Dataset.Rows == 0) throw new ArgumentException("The number of training instances is too small to create a leaf model"); 51 51 52 52 if (pd.Dataset.Rows == 1) -
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/LeafTypes/RegularizedLeaf.cs
r17080 r17081 31 31 namespace HeuristicLab.Algorithms.DataAnalysis { 32 32 [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 { 35 35 #region Constructors & Cloning 36 36 [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() { } 40 40 public override IDeepCloneable Clone(Cloner cloner) { 41 return new M5regLeaf(this, cloner);41 return new RegularizedLeaf(this, cloner); 42 42 } 43 43 #endregion -
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/MetaModels/RegressionNodeTreeModel.cs
r17080 r17081 32 32 namespace HeuristicLab.Algorithms.DataAnalysis { 33 33 [StorableType("FAF1F955-82F3-4824-9759-9D2846E831AE")] 34 public class RegressionNodeTreeModel : RegressionModel, I M5Model {34 public class RegressionNodeTreeModel : RegressionModel, IDecisionTreeModel { 35 35 public const string NumCurrentLeafsResultName = "Number of current leafs"; 36 36 public const string RootVariableName = "Root"; … … 69 69 #endregion 70 70 71 #region I M5Model71 #region IDecisionTreeModel 72 72 public void Build(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope statescope, ResultCollection results, CancellationToken cancellationToken) { 73 73 var regressionTreeParams = (RegressionTreeParameters)statescope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value; -
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/MetaModels/RegressionRuleModel.cs
r17080 r17081 33 33 namespace HeuristicLab.Algorithms.DataAnalysis { 34 34 [StorableType("425AF262-A756-4E9A-B76F-4D2480BEA4FD")] 35 public class RegressionRuleModel : RegressionModel, I M5Model {35 public class RegressionRuleModel : RegressionModel, IDecisionTreeModel { 36 36 #region Properties 37 37 [Storable] -
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/MetaModels/RegressionRuleSetModel.cs
r17080 r17081 33 33 namespace HeuristicLab.Algorithms.DataAnalysis { 34 34 [StorableType("7B4D9AE9-0456-4029-80A6-CCB5E33CE356")] 35 public class RegressionRuleSetModel : RegressionModel, I M5Model {35 public class RegressionRuleSetModel : RegressionModel, IDecisionTreeModel { 36 36 private const string NumRulesResultName = "Number of rules"; 37 37 private const string CoveredInstancesResultName = "Covered instances"; … … 75 75 #endregion 76 76 77 #region I M5Model77 #region IDecisionTreeModel 78 78 public void Build(IReadOnlyList<int> trainingRows, IReadOnlyList<int> pruningRows, IScope stateScope, ResultCollection results, CancellationToken cancellationToken) { 79 79 var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[DecisionTreeRegression.RegressionTreeParameterVariableName].Value; -
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/Properties/AssemblyInfo.cs.frame
r16855 r17081 28 28 // set of attributes. Change these attribute values to modify the information 29 29 // 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.")] 32 32 [assembly: AssemblyConfiguration("")] 33 33 [assembly: AssemblyCompany("")] -
trunk/HeuristicLab.Algorithms.DataAnalysis.DecisionTrees/3.4/Splitting/Splitter.cs
r17080 r17081 31 31 [StorableType("502B1429-7A28-45C1-A60A-93E72CB3AF4A")] 32 32 [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 { 34 34 public const string OrderParameterName = "Order"; 35 35 public IFixedValueParameter<DoubleValue> OrderParameter { … … 43 43 #region Constructors & Cloning 44 44 [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() { 48 48 Parameters.Add(new FixedValueParameter<DoubleValue>(OrderParameterName, "The exponent in the split calculation sum (x_i - x_avg)^Order (default=5).", new DoubleValue(5))); 49 49 } 50 50 public override IDeepCloneable Clone(Cloner cloner) { 51 return new M5Splitter(this, cloner);51 return new Splitter(this, cloner); 52 52 } 53 53 #endregion
Note: See TracChangeset
for help on using the changeset viewer.