Changeset 16847 for branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting
- Timestamp:
- 04/19/19 13:06:11 (6 years ago)
- Location:
- branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/CorrelationImpuritiyCalculator.cs
r15830 r16847 28 28 /// <summary> 29 29 /// Helper class for incremental split calculation. 30 /// Used while moving a potential Spliter along the ordered training Instances30 /// Used while moving a potential splitter along the ordered training instances 31 31 /// </summary> 32 internal class Correl ationImpuritiyCalculator {32 internal class CorreleationImpurityCalculator { 33 33 #region state 34 34 //Data … … 58 58 59 59 #region Constructors 60 public Correl ationImpuritiyCalculator(int partition, IEnumerable<double> atts, IEnumerable<double> targets, double order) {60 public CorreleationImpurityCalculator(int partition, IEnumerable<double> atts, IEnumerable<double> targets, double order) { 61 61 if (order <= 0) throw new ArgumentException("Splitter order must be larger than 0"); 62 62 this.order = order; -
branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/CorrelationSplitter.cs
r15830 r16847 25 25 using HeuristicLab.Data; 26 26 using HeuristicLab.Parameters; 27 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HEAL.Attic; 28 28 29 29 namespace HeuristicLab.Algorithms.DataAnalysis { 30 [Storable Class]30 [StorableType("EC3A5009-EE84-4E1A-A537-20F6F1224842")] 31 31 [Item("CorrelationSplitter", "An experimental split selector that uses correlation coefficients")] 32 32 public class CorrelationSplitter : SplitterBase { … … 37 37 public double Order { 38 38 get { return OrderParameter.Value.Value; } 39 set { OrderParameter.Value.Value = value; } 39 40 } 40 41 41 42 #region Constructors & Cloning 42 43 [StorableConstructor] 43 private CorrelationSplitter( bool deserializing) { }44 private CorrelationSplitter(StorableConstructorFlag _) { } 44 45 private CorrelationSplitter(CorrelationSplitter original, Cloner cloner) : base(original, cloner) { } 45 46 public CorrelationSplitter() { 46 Parameters.Add(new FixedValueParameter<DoubleValue>(OrderParameterName, "The exponent in the split calculation ssrLeft^(1/Order)+ssrRight^(1/Order) .", new DoubleValue(1)));47 Parameters.Add(new FixedValueParameter<DoubleValue>(OrderParameterName, "The exponent in the split calculation ssrLeft^(1/Order)+ssrRight^(1/Order) (default=1.0).", new DoubleValue(1))); 47 48 } 48 49 public override IDeepCloneable Clone(Cloner cloner) { … … 65 66 if (start >= length) return; 66 67 67 var imp = new Correl ationImpuritiyCalculator(minLeafSize, attValues, targetValues, Order);68 var imp = new CorreleationImpurityCalculator(minLeafSize, attValues, targetValues, Order); 68 69 maxImpurity = imp.Impurity; 69 70 splitValues.Add(imp.SplitValue); -
branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/M5Splitter.cs
r15830 r16847 26 26 using HeuristicLab.Data; 27 27 using HeuristicLab.Parameters; 28 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HEAL.Attic; 29 29 30 30 namespace HeuristicLab.Algorithms.DataAnalysis { 31 [Storable Class]32 [Item("M5Splitter", "A split selector that uses the ratio between Variances^(1/Order) to determine good splits ")]31 [StorableType("502B1429-7A28-45C1-A60A-93E72CB3AF4A")] 32 [Item("M5Splitter", "A split selector that uses the ratio between Variances^(1/Order) to determine good splits.")] 33 33 public class M5Splitter : SplitterBase { 34 34 public const string OrderParameterName = "Order"; … … 38 38 public double Order { 39 39 get { return OrderParameter.Value.Value; } 40 set { OrderParameter.Value.Value = value; } 40 41 } 41 42 42 43 #region Constructors & Cloning 43 44 [StorableConstructor] 44 private M5Splitter( bool deserializing) { }45 private M5Splitter(StorableConstructorFlag _) { } 45 46 private M5Splitter(M5Splitter original, Cloner cloner) : base(original, cloner) { } 46 47 public M5Splitter() { 47 Parameters.Add(new FixedValueParameter<DoubleValue>(OrderParameterName, "The exponent in the split calculation sum (x_i - x_avg)^Order .", new DoubleValue(5)));48 Parameters.Add(new FixedValueParameter<DoubleValue>(OrderParameterName, "The exponent in the split calculation sum (x_i - x_avg)^Order (default=5).", new DoubleValue(5))); 48 49 } 49 50 public override IDeepCloneable Clone(Cloner cloner) { … … 67 68 var imp = new OrderImpurityCalculator(part + 1, targetValues, Order); 68 69 69 //if (imp.Impurity > maxImpurity && !attValues[part - 1].IsAlmost(attValues[part])) {70 // maxImpurity = imp.Impurity;71 // splitValue = (attValues[part - 1] + attValues[part]) / 2;72 // position = part;73 //}74 75 70 for (var i = low + len; i < high - len; i++) { 76 71 imp.Increment(targetValues[i], OrderImpurityCalculator.IncrementType.Left); -
branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/OrderImpurityCalculator.cs
r15830 r16847 28 28 /// <summary> 29 29 /// Helper class for incremental split calculation. 30 /// Used while moving a potential Splitter along the ordered training Instances30 /// Used while moving a potential splitter along the ordered training instances 31 31 /// </summary> 32 32 internal class OrderImpurityCalculator { -
branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/SplitterBase.cs
r15830 r16847 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;29 28 using HeuristicLab.Problems.DataAnalysis; 29 using HEAL.Attic; 30 30 31 31 namespace HeuristicLab.Algorithms.DataAnalysis { 32 [Storable Class]33 [Item("SplitterBase", "A split selector that uses the ratio between Variances^(1/Order) to determine good splits")]32 [StorableType("22DCCF28-8943-4622-BBD3-B2AB04F28C36")] 33 [Item("SplitterBase", "Abstract base class for splitters")] 34 34 public abstract class SplitterBase : ParameterizedNamedItem, ISplitter { 35 35 public const string SplittingStateVariableName = "RuleSetState"; … … 37 37 #region Constructors & Cloning 38 38 [StorableConstructor] 39 protected SplitterBase( bool deserializing) { }39 protected SplitterBase(StorableConstructorFlag _) { } 40 40 protected SplitterBase(SplitterBase original, Cloner cloner) : base(original, cloner) { } 41 41 public SplitterBase() { } … … 46 46 states.Variables.Add(new Variable(SplittingStateVariableName, new SplittingState())); 47 47 } 48 48 49 public void Split(RegressionNodeTreeModel tree, IReadOnlyList<int> trainingRows, IScope stateScope, CancellationToken cancellationToken) { 49 50 var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[M5Regression.RegressionTreeParameterVariableName].Value; … … 87 88 if (splitData.Dataset.Rows < minLeafSize) return false; 88 89 89 // find best Attribute for the Splitter90 // find best attribute for the splitter 90 91 foreach (var attr in splitData.AllowedInputVariables) { 91 92 int pos; … … 109 110 #endregion 110 111 111 [Storable Class]112 [StorableType("BC1149FD-370E-4F3A-92F5-6E519736D09A")] 112 113 public class SplittingState : Item { 113 114 [Storable] … … 124 125 #region HLConstructors & Cloning 125 126 [StorableConstructor] 126 protected SplittingState( bool deserializing) : base(deserializing) { }127 protected SplittingState(StorableConstructorFlag _) : base(_) { } 127 128 protected SplittingState(SplittingState original, Cloner cloner) : base(original, cloner) { 128 129 nodeQueue = new Queue<RegressionNodeModel>(original.nodeQueue.Select(cloner.Clone)); -
branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/UnivariateOnlineLR.cs
r15830 r16847 28 28 /// <summary> 29 29 /// Helper class for incremental split calculation. 30 /// Used while moving a potential Spliter along the ordered training Instances30 /// Used while moving a potential splitter along the ordered training instances 31 31 /// </summary> 32 32 internal class UnivariateOnlineLR {
Note: See TracChangeset
for help on using the changeset viewer.