Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15132


Ignore:
Timestamp:
07/06/17 10:22:27 (7 years ago)
Author:
gkronber
Message:

#2650: merged r14827, r14829:14832 from trunk to stable

Location:
stable
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views/3.4/Plugin.cs.frame

    r14190 r15132  
    2828  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views","Provides views for symbolic classification problem classes.", "3.4.10.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.Views-3.4.dll", PluginFileType.Assembly)]
     30  [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")]
    3031  [PluginDependency("HeuristicLab.Common", "3.3")]
    3132  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/Plugin.cs.frame

    r14190 r15132  
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4.dll",PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")]
    31   [PluginDependency("HeuristicLab.Collections", "3.3")]
    3231  [PluginDependency("HeuristicLab.Common", "3.3")]
    3332  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariable.cs

    r15131 r15132  
    3030  [StorableClass]
    3131  [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 {
    3333
    3434    private readonly Dictionary<string, List<string>> variableValues;
     
    4747
    4848    [StorableConstructor]
    49     protected BinaryFactorVariable(bool deserializing)
     49    private BinaryFactorVariable(bool deserializing)
    5050      : base(deserializing) {
    5151      variableValues = new Dictionary<string, List<string>>();
    5252    }
    53     protected BinaryFactorVariable(BinaryFactorVariable original, Cloner cloner)
     53    private BinaryFactorVariable(BinaryFactorVariable original, Cloner cloner)
    5454      : base(original, cloner) {
    5555      variableValues =
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/FactorVariable.cs

    r15131 r15132  
    3030  [StorableClass]
    3131  [Item("FactorVariable", "Represents a categorical variable (comparable to factors as in R).")]
    32   public class FactorVariable : VariableBase {
     32  public sealed class FactorVariable : VariableBase {
    3333    private readonly Dictionary<string, Dictionary<string, int>> variableValues; // for each variable value also store a zero-based index
    3434    [Storable]
     
    4545
    4646    [StorableConstructor]
    47     protected FactorVariable(bool deserializing)
     47    private FactorVariable(bool deserializing)
    4848      : base(deserializing) {
    4949      variableValues = new Dictionary<string, Dictionary<string, int>>();
    5050    }
    51     protected FactorVariable(FactorVariable original, Cloner cloner)
     51    private FactorVariable(FactorVariable original, Cloner cloner)
    5252      : base(original, cloner) {
    5353      variableValues =
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/Variable.cs

    r15131 r15132  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
     
    2927  [StorableClass]
    3028  [Item("Variable", "Represents a variable value.")]
    31   public class Variable : VariableBase {
     29  public sealed class Variable : VariableBase {
    3230
    3331    [StorableConstructor]
    34     protected Variable(bool deserializing)
     32    private Variable(bool deserializing)
    3533      : base(deserializing) {
    3634    }
    37     protected Variable(Variable original, Cloner cloner)
     35    private Variable(Variable original, Cloner cloner)
    3836      : base(original, cloner) {
    3937    }
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableBase.cs

    r15131 r15132  
    3434      get { return weightMu; }
    3535      set {
    36         if(value != weightMu) {
     36        if (value != weightMu) {
    3737          weightMu = value;
    3838          OnChanged(EventArgs.Empty);
     
    4545      get { return weightSigma; }
    4646      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) {
    4949          weightSigma = value;
    5050          OnChanged(EventArgs.Empty);
     
    5757      get { return weightManipulatorMu; }
    5858      set {
    59         if(value != weightManipulatorMu) {
     59        if (value != weightManipulatorMu) {
    6060          weightManipulatorMu = value;
    6161          OnChanged(EventArgs.Empty);
     
    6868      get { return weightManipulatorSigma; }
    6969      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) {
    7272          weightManipulatorSigma = value;
    7373          OnChanged(EventArgs.Empty);
     
    8080      get { return multiplicativeWeightManipulatorSigma; }
    8181      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) {
    8484          multiplicativeWeightManipulatorSigma = value;
    8585          OnChanged(EventArgs.Empty);
     
    9494      get { return variableChangeProbability; }
    9595      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]");
    9797        variableChangeProbability = value;
    9898      }
     
    104104      get { return variableNames; }
    105105      set {
    106         if(value == null) throw new ArgumentNullException();
     106        if (value == null) throw new ArgumentNullException();
    107107        variableNames.Clear();
    108108        variableNames.AddRange(value);
     
    116116      get { return allVariableNames; }
    117117      set {
    118         if(value == null) throw new ArgumentNullException();
     118        if (value == null) throw new ArgumentNullException();
    119119        allVariableNames.Clear();
    120120        allVariableNames.AddRange(value);
     
    124124    public override bool Enabled {
    125125      get {
    126         if(variableNames.Count == 0) return false;
     126        if (variableNames.Count == 0) return false;
    127127        return base.Enabled;
    128128      }
    129129      set {
    130         if(variableNames.Count == 0) base.Enabled = false;
     130        if (variableNames.Count == 0) base.Enabled = false;
    131131        else base.Enabled = value;
    132132      }
     
    146146    [StorableHook(HookType.AfterDeserialization)]
    147147    private void AfterDeserialization() {
    148       if(allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {
     148      if (allVariableNames == null || (allVariableNames.Count == 0 && variableNames.Count > 0)) {
    149149        allVariableNames = variableNames;
    150150      }
     
    167167      multiplicativeWeightManipulatorSigma = original.multiplicativeWeightManipulatorSigma;
    168168      variableChangeProbability = original.variableChangeProbability;
    169       }
     169    }
    170170    protected VariableBase(string name, string description)
    171171      : base(name, description) {
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/VariableTreeNodeBase.cs

    r15131 r15132  
    7979      }
    8080
    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
    8384#pragma warning disable 612, 618
    8485        variableName = Symbol.VariableNames.SelectRandom(random);
    8586#pragma warning restore 612, 618
     87        #endregion
     88      } else if (random.NextDouble() < Symbol.VariableChangeProbability) {
     89        var oldName = variableName;
     90        variableName = Symbol.VariableNames.SampleRandom(random);
    8691        if (oldName != variableName) {
     92          // re-initialize weight if the variable is changed
    8793          weight = NormalDistributedRandom.NextDouble(random, Symbol.WeightMu, Symbol.WeightSigma);
    8894        }
  • stable/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPSymbolicClassificationSampleTest.cs

    r14186 r15132  
    100100      grammar.ConfigureAsDefaultClassificationGrammar();
    101101      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();
    103104      varSymbol.WeightMu = 1.0;
    104105      varSymbol.WeightSigma = 1.0;
  • stable/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPSymbolicRegressionSampleTest.cs

    r14186 r15132  
    101101      grammar.ConfigureAsDefaultRegressionGrammar();
    102102      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();
    104105      varSymbol.WeightMu = 1.0;
    105106      varSymbol.WeightSigma = 1.0;
  • stable/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPTimeSeriesSampleTest.cs

    r14941 r15132  
    7474          autoRegressiveSymbol.MaxLag = -1;
    7575        }
     76        if (symbol is VariableBase) {
     77          var varSy = symbol as VariableBase;
     78          varSy.VariableChangeProbability = 1.0; // backwards compatibility
     79        }
    7680      }
    7781
Note: See TracChangeset for help on using the changeset viewer.