- Timestamp:
- 04/09/10 17:28:32 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Symbols
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Symbols/Constant.cs
r3269 r3294 31 31 [Item("Constant", "Represents a constant value.")] 32 32 public sealed class Constant : Symbol { 33 #region Parameter Properties 34 public IValueParameter<DoubleValue> MinValueParameter { 35 get { return (IValueParameter<DoubleValue>)Parameters["MinValue"]; } 33 #region Propeties 34 private double minValue; 35 public double MinValue { 36 get { return minValue; } 37 set { minValue = value; } 36 38 } 37 public IValueParameter<DoubleValue> MaxValueParameter { 38 get { return (IValueParameter<DoubleValue>)Parameters["MaxValue"]; } 39 } 40 #endregion 41 #region Propeties 42 public DoubleValue MinValue { 43 get { return MinValueParameter.Value; } 44 set { MinValueParameter.Value = value; } 45 } 46 public DoubleValue MaxValue { 47 get { return MaxValueParameter.Value; } 48 set { MaxValueParameter.Value = value; } 39 private double maxValue; 40 public double MaxValue { 41 get { return maxValue; } 42 set { maxValue = value; } 49 43 } 50 44 #endregion 51 45 public Constant() 52 46 : base() { 53 Parameters.Add(new ValueParameter<DoubleValue>("MinValue", "The minimal value of the constant.", new DoubleValue(-20.0)));54 Parameters.Add(new ValueParameter<DoubleValue>("MaxValue", "The maximal value of the constant.", new DoubleValue(20.0)));55 47 } 56 48 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Symbols/ConstantTreeNode.cs
r3269 r3294 55 55 public override void ResetLocalParameters(IRandom random) { 56 56 base.ResetLocalParameters(random); 57 var range = Symbol.MaxValue .Value - Symbol.MaxValue.Value;58 Value = random.NextDouble() * range - Symbol.MinValue .Value;57 var range = Symbol.MaxValue - Symbol.MaxValue; 58 Value = random.NextDouble() * range - Symbol.MinValue; 59 59 } 60 60 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Symbols/Variable.cs
r3269 r3294 27 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 using HeuristicLab.Parameters; 29 using System.Collections.Generic; 30 using System; 29 31 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Symbols { 30 32 [StorableClass] 31 33 [Item("Variable", "Represents a variable value.")] 32 34 public sealed class Variable : Symbol { 33 #region Parameter Properties 34 public IValueParameter<DoubleValue> WeightNuParameter { 35 get { return (IValueParameter<DoubleValue>)Parameters["WeightNu"]; } 35 #region Properties 36 private double weightNu; 37 [Storable] 38 public double WeightNu { 39 get { return weightNu; } 40 set { weightNu = value; } 36 41 } 37 public IValueParameter<DoubleValue> WeightSigmaParameter { 38 get { return (IValueParameter<DoubleValue>)Parameters["WeightSigma"]; } 42 private double weightSigma; 43 [Storable] 44 public double WeightSigma { 45 get { return weightSigma; } 46 set { 47 if (weightSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed."); 48 weightSigma = value; 49 } 39 50 } 40 public IValueParameter<ItemList<StringValue>> VariableNamesParameter { 41 get { return (IValueParameter<ItemList<StringValue>>)Parameters["VariableNames"]; } 42 } 43 #endregion 44 #region Properties 45 public DoubleValue WeightNu { 46 get { return WeightNuParameter.Value; } 47 set { WeightNuParameter.Value = value; } 48 } 49 public DoubleValue WeightSigma { 50 get { return WeightSigmaParameter.Value; } 51 set { WeightSigmaParameter.Value = value; } 52 } 53 public ItemList<StringValue> VariableNames { 54 get { return VariableNamesParameter.Value; } 55 set { VariableNamesParameter.Value = value; } 51 private List<string> variableNames; 52 [Storable] 53 public ICollection<string> VariableNames { 54 get { return variableNames; } 55 set { 56 if (value == null) throw new ArgumentNullException(); 57 variableNames.Clear(); 58 variableNames.AddRange(value); 59 } 56 60 } 57 61 #endregion 58 62 public Variable() 59 63 : base() { 60 Parameters.Add(new ValueParameter<DoubleValue>("WeightNu", "The mean value for the initialization of weight ((N(nu, sigma)).", new DoubleValue(1.0)));61 Parameters.Add(new ValueParameter<DoubleValue>("WeightSigma", "The sigma value for the initialization of weight (N(nu, sigma))", new DoubleValue(1.0)));62 Parameters.Add(new ValueParameter<ItemList<StringValue>>("VariableNames", "The list of possible variable names for initialization."));64 weightNu = 1.0; 65 weightSigma = 1.0; 66 variableNames = new List<string>(); 63 67 } 64 68 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Symbols/VariableTreeNode.cs
r3269 r3294 57 57 public override void ResetLocalParameters(IRandom random) { 58 58 base.ResetLocalParameters(random); 59 var normalDistributedRNG = new NormalDistributedRandom(random, Symbol.WeightNu .Value, Symbol.WeightSigma.Value);59 var normalDistributedRNG = new NormalDistributedRandom(random, Symbol.WeightNu, Symbol.WeightSigma); 60 60 weight = normalDistributedRNG.NextDouble(); 61 int variableIndex = random.Next(0, Symbol.VariableNames.Count); 62 variableName = Symbol.VariableNames[variableIndex].Value; 61 var variableList = new List<string>(Symbol.VariableNames); 62 int variableIndex = random.Next(0, variableList.Count); 63 variableName = variableList[variableIndex]; 63 64 } 64 65
Note: See TracChangeset
for help on using the changeset viewer.