Changeset 15132
- Timestamp:
- 07/06/17 10:22:27 (7 years ago)
- Location:
- stable
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/Plugin.cs.frame
r14190 r15132 28 28 [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views","Provides views for symbolic classification problem classes.", "3.4.10.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")] 30 31 [PluginDependency("HeuristicLab.Common", "3.3")] 31 32 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/Plugin.cs.frame
r14190 r15132 29 29 [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4.dll",PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")] 31 [PluginDependency("HeuristicLab.Collections", "3.3")]32 31 [PluginDependency("HeuristicLab.Common", "3.3")] 33 32 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariable.cs
r15131 r15132 30 30 [StorableClass] 31 31 [Item("BinaryFactorVariable", "Represents a categorical variable (comparable to factors as in R) and it's value.")] 32 public class BinaryFactorVariable : VariableBase {32 public sealed class BinaryFactorVariable : VariableBase { 33 33 34 34 private readonly Dictionary<string, List<string>> variableValues; … … 47 47 48 48 [StorableConstructor] 49 pr otectedBinaryFactorVariable(bool deserializing)49 private BinaryFactorVariable(bool deserializing) 50 50 : base(deserializing) { 51 51 variableValues = new Dictionary<string, List<string>>(); 52 52 } 53 pr otectedBinaryFactorVariable(BinaryFactorVariable original, Cloner cloner)53 private BinaryFactorVariable(BinaryFactorVariable original, Cloner cloner) 54 54 : base(original, cloner) { 55 55 variableValues = -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariable.cs
r15131 r15132 30 30 [StorableClass] 31 31 [Item("FactorVariable", "Represents a categorical variable (comparable to factors as in R).")] 32 public class FactorVariable : VariableBase {32 public sealed class FactorVariable : VariableBase { 33 33 private readonly Dictionary<string, Dictionary<string, int>> variableValues; // for each variable value also store a zero-based index 34 34 [Storable] … … 45 45 46 46 [StorableConstructor] 47 pr otectedFactorVariable(bool deserializing)47 private FactorVariable(bool deserializing) 48 48 : base(deserializing) { 49 49 variableValues = new Dictionary<string, Dictionary<string, int>>(); 50 50 } 51 pr otectedFactorVariable(FactorVariable original, Cloner cloner)51 private FactorVariable(FactorVariable original, Cloner cloner) 52 52 : base(original, cloner) { 53 53 variableValues = -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs
r15131 r15132 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 22 using HeuristicLab.Common; 25 23 using HeuristicLab.Core; … … 29 27 [StorableClass] 30 28 [Item("Variable", "Represents a variable value.")] 31 public class Variable : VariableBase {29 public sealed class Variable : VariableBase { 32 30 33 31 [StorableConstructor] 34 pr otectedVariable(bool deserializing)32 private Variable(bool deserializing) 35 33 : base(deserializing) { 36 34 } 37 pr otectedVariable(Variable original, Cloner cloner)35 private Variable(Variable original, Cloner cloner) 38 36 : base(original, cloner) { 39 37 } -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableBase.cs
r15131 r15132 34 34 get { return weightMu; } 35 35 set { 36 if (value != weightMu) {36 if (value != weightMu) { 37 37 weightMu = value; 38 38 OnChanged(EventArgs.Empty); … … 45 45 get { return weightSigma; } 46 46 set { 47 if (weightSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");48 if (value != weightSigma) {47 if (weightSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed."); 48 if (value != weightSigma) { 49 49 weightSigma = value; 50 50 OnChanged(EventArgs.Empty); … … 57 57 get { return weightManipulatorMu; } 58 58 set { 59 if (value != weightManipulatorMu) {59 if (value != weightManipulatorMu) { 60 60 weightManipulatorMu = value; 61 61 OnChanged(EventArgs.Empty); … … 68 68 get { return weightManipulatorSigma; } 69 69 set { 70 if (weightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");71 if (value != weightManipulatorSigma) {70 if (weightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed."); 71 if (value != weightManipulatorSigma) { 72 72 weightManipulatorSigma = value; 73 73 OnChanged(EventArgs.Empty); … … 80 80 get { return multiplicativeWeightManipulatorSigma; } 81 81 set { 82 if (multiplicativeWeightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed.");83 if (value != multiplicativeWeightManipulatorSigma) {82 if (multiplicativeWeightManipulatorSigma < 0.0) throw new ArgumentException("Negative sigma is not allowed."); 83 if (value != multiplicativeWeightManipulatorSigma) { 84 84 multiplicativeWeightManipulatorSigma = value; 85 85 OnChanged(EventArgs.Empty); … … 94 94 get { return variableChangeProbability; } 95 95 set { 96 if (value < 0 || value > 1.0) throw new ArgumentException("Variable change probability must lie in the interval [0..1]");96 if (value < 0 || value > 1.0) throw new ArgumentException("Variable change probability must lie in the interval [0..1]"); 97 97 variableChangeProbability = value; 98 98 } … … 104 104 get { return variableNames; } 105 105 set { 106 if (value == null) throw new ArgumentNullException();106 if (value == null) throw new ArgumentNullException(); 107 107 variableNames.Clear(); 108 108 variableNames.AddRange(value); … … 116 116 get { return allVariableNames; } 117 117 set { 118 if (value == null) throw new ArgumentNullException();118 if (value == null) throw new ArgumentNullException(); 119 119 allVariableNames.Clear(); 120 120 allVariableNames.AddRange(value); … … 124 124 public override bool Enabled { 125 125 get { 126 if (variableNames.Count == 0) return false;126 if (variableNames.Count == 0) return false; 127 127 return base.Enabled; 128 128 } 129 129 set { 130 if (variableNames.Count == 0) base.Enabled = false;130 if (variableNames.Count == 0) base.Enabled = false; 131 131 else base.Enabled = value; 132 132 } … … 146 146 [StorableHook(HookType.AfterDeserialization)] 147 147 private void AfterDeserialization() { 148 if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {148 if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) { 149 149 allVariableNames = variableNames; 150 150 } … … 167 167 multiplicativeWeightManipulatorSigma = original.multiplicativeWeightManipulatorSigma; 168 168 variableChangeProbability = original.variableChangeProbability; 169 169 } 170 170 protected VariableBase(string name, string description) 171 171 : base(name, description) { -
stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNodeBase.cs
r15131 r15132 79 79 } 80 80 81 if (Symbol.VariableChangeProbability >= 1.0 || random.NextDouble() < Symbol.VariableChangeProbability) { 82 var oldName = variableName; 81 if (Symbol.VariableChangeProbability >= 1.0) { 82 // old behaviour for backwards compatibility 83 #region Backwards compatible code, remove with 3.4 83 84 #pragma warning disable 612, 618 84 85 variableName = Symbol.VariableNames.SelectRandom(random); 85 86 #pragma warning restore 612, 618 87 #endregion 88 } else if (random.NextDouble() < Symbol.VariableChangeProbability) { 89 var oldName = variableName; 90 variableName = Symbol.VariableNames.SampleRandom(random); 86 91 if (oldName != variableName) { 92 // re-initialize weight if the variable is changed 87 93 weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma); 88 94 } -
stable/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPSymbolicClassificationSampleTest.cs
r14186 r15132 100 100 grammar.ConfigureAsDefaultClassificationGrammar(); 101 101 grammar.Symbols.OfType<VariableCondition>().Single().Enabled = false; 102 var varSymbol = grammar.Symbols.OfType<Variable>().Where(x => !(x is LaggedVariable)).Single(); 102 foreach (var varSy in grammar.Symbols.OfType<VariableBase>()) varSy.VariableChangeProbability = 1.0; // for backwards compatibilty 103 var varSymbol = grammar.Symbols.OfType<Variable>().Single(); 103 104 varSymbol.WeightMu = 1.0; 104 105 varSymbol.WeightSigma = 1.0; -
stable/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPSymbolicRegressionSampleTest.cs
r14186 r15132 101 101 grammar.ConfigureAsDefaultRegressionGrammar(); 102 102 grammar.Symbols.OfType<VariableCondition>().Single().InitialFrequency = 0.0; 103 var varSymbol = grammar.Symbols.OfType<Variable>().Where(x => !(x is LaggedVariable)).Single(); 103 foreach (var varSy in grammar.Symbols.OfType<VariableBase>()) varSy.VariableChangeProbability = 1.0; // for backwards compatibilty 104 var varSymbol = grammar.Symbols.OfType<Variable>().Single(); 104 105 varSymbol.WeightMu = 1.0; 105 106 varSymbol.WeightSigma = 1.0; -
stable/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPTimeSeriesSampleTest.cs
r14941 r15132 74 74 autoRegressiveSymbol.MaxLag = -1; 75 75 } 76 if (symbol is VariableBase) { 77 var varSy = symbol as VariableBase; 78 varSy.VariableChangeProbability = 1.0; // backwards compatibility 79 } 76 80 } 77 81
Note: See TracChangeset
for help on using the changeset viewer.