Changeset 14758 for branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariableTreeNode.cs
- Timestamp:
- 03/18/17 10:36:37 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariableTreeNode.cs
r14717 r14758 75 75 76 76 public override void ShakeLocalParameters(IRandom random, double shakingFactor) { 77 if(random.NextDouble() < 0.2) { 77 // mutate only one randomly selected weight 78 var idx = random.Next(weights.Length); 79 // 50% additive & 50% multiplicative 80 if(random.NextDouble() < 0.5) { 81 double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu, 82 Symbol.WeightManipulatorSigma); 83 weights[idx] = weights[idx] + x * shakingFactor; 84 } else { 85 double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma); 86 weights[idx] = weights[idx] * x; 87 } 88 if(random.NextDouble() < Symbol.VariableChangeProbability) { 78 89 VariableName = Symbol.VariableNames.SampleRandom(random); 79 90 if(weights.Length != Symbol.GetVariableValues(VariableName).Count()) { … … 83 94 .Select(_ => NormalDistributedRandom.NextDouble(random, 0, 1)) 84 95 .ToArray(); 85 }86 } else {87 // mutate only one randomly selected weight88 var idx = random.Next(weights.Length);89 // 50% additive & 50% multiplicative90 if(random.NextDouble() < 0.5) {91 double x = NormalDistributedRandom.NextDouble(random, Symbol.WeightManipulatorMu,92 Symbol.WeightManipulatorSigma);93 weights[idx] = weights[idx] + x * shakingFactor;94 } else {95 double x = NormalDistributedRandom.NextDouble(random, 1.0, Symbol.MultiplicativeWeightManipulatorSigma);96 weights[idx] = weights[idx] * x;97 96 } 98 97 }
Note: See TracChangeset
for help on using the changeset viewer.