Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/19/19 13:06:11 (6 years ago)
Author:
gkronber
Message:

#2847: made some minor changes while reviewing

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  
    2828  /// <summary>
    2929  /// Helper class for incremental split calculation.
    30   /// Used while moving a potential Spliter along the ordered training Instances
     30  /// Used while moving a potential splitter along the ordered training instances
    3131  /// </summary>
    32   internal class CorrelationImpuritiyCalculator {
     32  internal class CorreleationImpurityCalculator {
    3333    #region state
    3434    //Data
     
    5858
    5959    #region Constructors
    60     public CorrelationImpuritiyCalculator(int partition, IEnumerable<double> atts, IEnumerable<double> targets, double order) {
     60    public CorreleationImpurityCalculator(int partition, IEnumerable<double> atts, IEnumerable<double> targets, double order) {
    6161      if (order <= 0) throw new ArgumentException("Splitter order must be larger than 0");
    6262      this.order = order;
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/CorrelationSplitter.cs

    r15830 r16847  
    2525using HeuristicLab.Data;
    2626using HeuristicLab.Parameters;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Algorithms.DataAnalysis {
    30   [StorableClass]
     30  [StorableType("EC3A5009-EE84-4E1A-A537-20F6F1224842")]
    3131  [Item("CorrelationSplitter", "An experimental split selector that uses correlation coefficients")]
    3232  public class CorrelationSplitter : SplitterBase {
     
    3737    public double Order {
    3838      get { return OrderParameter.Value.Value; }
     39      set { OrderParameter.Value.Value = value; }
    3940    }
    4041
    4142    #region Constructors & Cloning
    4243    [StorableConstructor]
    43     private CorrelationSplitter(bool deserializing) { }
     44    private CorrelationSplitter(StorableConstructorFlag _) { }
    4445    private CorrelationSplitter(CorrelationSplitter original, Cloner cloner) : base(original, cloner) { }
    4546    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)));
    4748    }
    4849    public override IDeepCloneable Clone(Cloner cloner) {
     
    6566      if (start >= length) return;
    6667
    67       var imp = new CorrelationImpuritiyCalculator(minLeafSize, attValues, targetValues, Order);
     68      var imp = new CorreleationImpurityCalculator(minLeafSize, attValues, targetValues, Order);
    6869      maxImpurity = imp.Impurity;
    6970      splitValues.Add(imp.SplitValue);
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/M5Splitter.cs

    r15830 r16847  
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Parameters;
    28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Algorithms.DataAnalysis {
    31   [StorableClass]
    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.")]
    3333  public class M5Splitter : SplitterBase {
    3434    public const string OrderParameterName = "Order";
     
    3838    public double Order {
    3939      get { return OrderParameter.Value.Value; }
     40      set { OrderParameter.Value.Value = value; }
    4041    }
    4142
    4243    #region Constructors & Cloning
    4344    [StorableConstructor]
    44     private M5Splitter(bool deserializing) { }
     45    private M5Splitter(StorableConstructorFlag _) { }
    4546    private M5Splitter(M5Splitter original, Cloner cloner) : base(original, cloner) { }
    4647    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)));
    4849    }
    4950    public override IDeepCloneable Clone(Cloner cloner) {
     
    6768      var imp = new OrderImpurityCalculator(part + 1, targetValues, Order);
    6869
    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 
    7570      for (var i = low + len; i < high - len; i++) {
    7671        imp.Increment(targetValues[i], OrderImpurityCalculator.IncrementType.Left);
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/OrderImpurityCalculator.cs

    r15830 r16847  
    2828  /// <summary>
    2929  /// Helper class for incremental split calculation.
    30   /// Used while moving a potential Splitter along the ordered training Instances
     30  /// Used while moving a potential splitter along the ordered training instances
    3131  /// </summary>
    3232  internal class OrderImpurityCalculator {
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/SplitterBase.cs

    r15830 r16847  
    2626using HeuristicLab.Common;
    2727using HeuristicLab.Core;
    28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928using HeuristicLab.Problems.DataAnalysis;
     29using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Algorithms.DataAnalysis {
    32   [StorableClass]
    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")]
    3434  public abstract class SplitterBase : ParameterizedNamedItem, ISplitter {
    3535    public const string SplittingStateVariableName = "RuleSetState";
     
    3737    #region Constructors & Cloning
    3838    [StorableConstructor]
    39     protected SplitterBase(bool deserializing) { }
     39    protected SplitterBase(StorableConstructorFlag _) { }
    4040    protected SplitterBase(SplitterBase original, Cloner cloner) : base(original, cloner) { }
    4141    public SplitterBase() { }
     
    4646      states.Variables.Add(new Variable(SplittingStateVariableName, new SplittingState()));
    4747    }
     48
    4849    public void Split(RegressionNodeTreeModel tree, IReadOnlyList<int> trainingRows, IScope stateScope, CancellationToken cancellationToken) {
    4950      var regressionTreeParams = (RegressionTreeParameters)stateScope.Variables[M5Regression.RegressionTreeParameterVariableName].Value;
     
    8788      if (splitData.Dataset.Rows < minLeafSize) return false;
    8889
    89       //find best Attribute for the Splitter
     90      // find best attribute for the splitter
    9091      foreach (var attr in splitData.AllowedInputVariables) {
    9192        int pos;
     
    109110    #endregion
    110111
    111     [StorableClass]
     112    [StorableType("BC1149FD-370E-4F3A-92F5-6E519736D09A")]
    112113    public class SplittingState : Item {
    113114      [Storable]
     
    124125      #region HLConstructors & Cloning
    125126      [StorableConstructor]
    126       protected SplittingState(bool deserializing) : base(deserializing) { }
     127      protected SplittingState(StorableConstructorFlag _) : base(_) { }
    127128      protected SplittingState(SplittingState original, Cloner cloner) : base(original, cloner) {
    128129        nodeQueue = new Queue<RegressionNodeModel>(original.nodeQueue.Select(cloner.Clone));
  • branches/2847_M5Regression/HeuristicLab.Algorithms.DataAnalysis/3.4/M5Regression/Spliting/UnivariateOnlineLR.cs

    r15830 r16847  
    2828  /// <summary>
    2929  /// Helper class for incremental split calculation.
    30   /// Used while moving a potential Spliter along the ordered training Instances
     30  /// Used while moving a potential splitter along the ordered training instances
    3131  /// </summary>
    3232  internal class UnivariateOnlineLR {
Note: See TracChangeset for help on using the changeset viewer.