Ignore:
Timestamp:
07/09/10 17:01:36 (11 years ago)
Author:
gkronber
Message:

Worked on symbolic regression classes to prepare for time series prognosis plugin. #1081

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs

    r3997 r4022  
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols {
    3131  [StorableClass]
    32   public sealed class LaggedVariableTreeNode : SymbolicExpressionTreeTerminalNode {
     32  public sealed class LaggedVariableTreeNode : VariableTreeNode {
    3333    public new LaggedVariable Symbol {
    3434      get { return (LaggedVariable)base.Symbol; }
    35     }
    36     [Storable]
    37     private double weight;
    38     public double Weight {
    39       get { return weight; }
    40       set { weight = value; }
    41     }
    42     [Storable]
    43     private string variableName;
    44     public string VariableName {
    45       get { return variableName; }
    46       set { variableName = value; }
    4735    }
    4836    [Storable]
     
    5846    private LaggedVariableTreeNode(LaggedVariableTreeNode original)
    5947      : base(original) {
    60       weight = original.weight;
    61       variableName = original.variableName;
    6248      lag = original.lag;
    6349    }
     
    7359    public override void ResetLocalParameters(IRandom random) {
    7460      base.ResetLocalParameters(random);
    75       weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightNu, Symbol.WeightSigma);
    76       variableName = Symbol.VariableNames.SelectRandom(random);
    7761      lag = random.Next(Symbol.MinLag, Symbol.MaxLag + 1);
    7862    }
     
    8064    public override void ShakeLocalParameters(IRandom random, double shakingFactor) {
    8165      base.ShakeLocalParameters(random, shakingFactor);
    82       double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorNu, Symbol.WeightManipulatorSigma);
    83       weight = weight + x * shakingFactor;
    84       variableName = Symbol.VariableNames.SelectRandom(random);
    85       lag = lag + random.Next(-1, 2);
     66      lag = Math.Min(Symbol.MaxLag, Math.Max(Symbol.MinLag, lag + random.Next(-1, 2)));
    8667    }
    8768
     
    9273
    9374    public override string ToString() {
    94       return weight.ToString("E4") + " " + variableName + " (t" + (lag > 0 ? "+" : "") + lag + ")";
     75      return base.ToString() +
     76        " (t" + (lag > 0 ? "+" : "") + lag + ")";
    9577    }
    9678  }
Note: See TracChangeset for help on using the changeset viewer.