Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14243


Ignore:
Timestamp:
08/08/16 13:00:06 (8 years ago)
Author:
gkronber
Message:

#2650: renamed FactorVariable -> BinaryFactorVariable

Location:
branches/symbreg-factors-2650
Files:
15 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/symbreg-factors-2650/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearDiscriminantAnalysis.cs

    r14240 r14243  
    103103        var varName = kvp.Key;
    104104        foreach (var cat in kvp.Value) {
    105           FactorVariableTreeNode vNode =
    106             (FactorVariableTreeNode)new HeuristicLab.Problems.DataAnalysis.Symbolic.FactorVariable().CreateTreeNode();
     105          BinaryFactorVariableTreeNode vNode =
     106            (BinaryFactorVariableTreeNode)new HeuristicLab.Problems.DataAnalysis.Symbolic.BinaryFactorVariable().CreateTreeNode();
    107107          vNode.VariableName = varName;
    108108          vNode.VariableValue = cat;
  • branches/symbreg-factors-2650/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs

    r14240 r14243  
    107107        var varName = kvp.Key;
    108108        foreach (var cat in kvp.Value) {
    109           FactorVariableTreeNode vNode =
    110             (FactorVariableTreeNode)new HeuristicLab.Problems.DataAnalysis.Symbolic.FactorVariable().CreateTreeNode();
     109          BinaryFactorVariableTreeNode vNode =
     110            (BinaryFactorVariableTreeNode)new HeuristicLab.Problems.DataAnalysis.Symbolic.BinaryFactorVariable().CreateTreeNode();
    111111          vNode.VariableName = varName;
    112112          vNode.VariableValue = cat;
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/Evaluators/SymbolicRegressionConstantOptimizationEvaluator.cs

    r14237 r14243  
    205205          ConstantTreeNode constantTreeNode = node as ConstantTreeNode;
    206206          VariableTreeNode variableTreeNode = node as VariableTreeNode;
    207           FactorVariableTreeNode factorVariableTreeNode = node as FactorVariableTreeNode;
     207          BinaryFactorVariableTreeNode factorVariableTreeNode = node as BinaryFactorVariableTreeNode;
    208208          if (constantTreeNode != null)
    209209            c[i++] = constantTreeNode.Value;
     
    273273        ConstantTreeNode constantTreeNode = node as ConstantTreeNode;
    274274        VariableTreeNode variableTreeNode = node as VariableTreeNode;
    275         FactorVariableTreeNode factorVarTreeNode = node as FactorVariableTreeNode;
     275        BinaryFactorVariableTreeNode factorVarTreeNode = node as BinaryFactorVariableTreeNode;
    276276        if (constantTreeNode != null)
    277277          constantTreeNode.Value = constants[i++];
     
    305305        return true;
    306306      }
    307       if (node.Symbol is Variable || node.Symbol is FactorVariable) {
     307      if (node.Symbol is Variable || node.Symbol is BinaryFactorVariable) {
    308308        var varNode = node as VariableTreeNodeBase;
    309         var factorVarNode = node as FactorVariableTreeNode;
     309        var factorVarNode = node as BinaryFactorVariableTreeNode;
    310310        // factor variable values are only 0 or 1 and set in x accordingly
    311311        var par = new AutoDiff.Variable();
     
    493493        where
    494494         !(n.Symbol is Variable) &&
    495          !(n.Symbol is FactorVariable) &&
     495         !(n.Symbol is BinaryFactorVariable) &&
    496496         !(n.Symbol is Constant) &&
    497497         !(n.Symbol is Addition) &&
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs

    r14238 r14243  
    3535  [View("Variable View")]
    3636  [Content(typeof(Variable), true)]
    37   [Content(typeof(FactorVariable), true)]
     37  [Content(typeof(BinaryFactorVariable), true)]
    3838  public partial class VariableView : SymbolView {
    3939    private CheckedItemCollectionView<StringValue> variableNamesView;
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisVariableFrequencyAnalyzer.cs

    r14238 r14243  
    168168        tree.Root.ForEachNodePrefix(node => {
    169169          if (node is IVariableTreeNode) {
    170             var factorNode = node as FactorVariableTreeNode;
     170            var factorNode = node as BinaryFactorVariableTreeNode;
    171171            if (factorNode != null && !aggregateFactorVariables) {
    172172              IncReferenceCount(references, factorNode.VariableName + "=" + factorNode.VariableValue);
     
    186186      if (node is IVariableTreeNode) {
    187187        var laggedVarTreeNode = node as LaggedVariableTreeNode;
    188         var factorVarTreeNode = node as FactorVariableTreeNode;
     188        var factorVarTreeNode = node as BinaryFactorVariableTreeNode;
    189189        var varConditionTreeNode = node as VariableConditionTreeNode;
    190190        if (laggedVarTreeNode != null) {
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/ArithmeticExpressionGrammar.cs

    r14232 r14243  
    5353      constant.MaxValue = 20;
    5454      var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable();
    55       var factorVariableSymbol = new FactorVariable();
     55      var factorVariableSymbol = new BinaryFactorVariable();
    5656
    5757      var allSymbols = new List<Symbol>() { add, sub, mul, div, constant, variableSymbol, factorVariableSymbol };
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/FullFunctionalExpressionGrammar.cs

    r14232 r14243  
    115115      constant.MaxValue = 20;
    116116      var variableSymbol = new HeuristicLab.Problems.DataAnalysis.Symbolic.Variable();
    117       var factorVariable = new FactorVariable();
     117      var factorVariable = new BinaryFactorVariable();
    118118      var laggedVariable = new LaggedVariable();
    119119      laggedVariable.InitialFrequency = 0.0;
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Grammars/TypeCoherentExpressionGrammar.cs

    r14232 r14243  
    104104      constant.MaxValue = 20;
    105105      var variableSymbol = new Variable();
    106       var factorVariable = new FactorVariable();
     106      var factorVariable = new BinaryFactorVariable();
    107107      var laggedVariable = new LaggedVariable();
    108108      var autoregressiveVariable = new AutoregressiveTargetVariable();
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs

    r14232 r14243  
    132132      { typeof(Erf), OpCodes.Erf},
    133133      { typeof(Bessel), OpCodes.Bessel},
    134       { typeof(FactorVariable), OpCodes.FactorVariable }
     134      { typeof(BinaryFactorVariable), OpCodes.FactorVariable }
    135135    };
    136136
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r14237 r14243  
    629629          }
    630630        case OpCodes.FactorVariable: {
    631             FactorVariableTreeNode varNode = currentInstr.dynamicNode as FactorVariableTreeNode;
     631            BinaryFactorVariableTreeNode varNode = currentInstr.dynamicNode as BinaryFactorVariableTreeNode;
    632632            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_1); // load columns array
    633633            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, (int)currentInstr.data);
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs

    r14237 r14243  
    145145          instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
    146146        } else if (instr.opCode == OpCodes.FactorVariable) {
    147           var factorTreeNode = instr.dynamicNode as FactorVariableTreeNode;
     147          var factorTreeNode = instr.dynamicNode as BinaryFactorVariableTreeNode;
    148148          instr.data = dataset.GetReadOnlyStringValues(factorTreeNode.VariableName);
    149149        } else if (instr.opCode == OpCodes.LagVariable) {
     
    461461        case OpCodes.FactorVariable: {
    462462            if (row < 0 || row >= dataset.Rows) return double.NaN;
    463             var factorVarTreeNode = currentInstr.dynamicNode as FactorVariableTreeNode;
     463            var factorVarTreeNode = currentInstr.dynamicNode as BinaryFactorVariableTreeNode;
    464464            return ((IList<string>)currentInstr.data)[row] == factorVarTreeNode.VariableValue ? factorVarTreeNode.Weight : 0;
    465465          }
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs

    r14237 r14243  
    151151          if (row < 0 || row >= dataset.Rows) instr.value = double.NaN;
    152152          else {
    153             var factorTreeNode = instr.dynamicNode as FactorVariableTreeNode;
     153            var factorTreeNode = instr.dynamicNode as BinaryFactorVariableTreeNode;
    154154            instr.value = ((IList<string>)instr.data)[row] == factorTreeNode.VariableValue ? factorTreeNode.Weight : 0;
    155155          }
     
    399399            break;
    400400          case OpCodes.FactorVariable: {
    401               var factorVariableTreeNode = instr.dynamicNode as FactorVariableTreeNode;
     401              var factorVariableTreeNode = instr.dynamicNode as BinaryFactorVariableTreeNode;
    402402              instr.data = dataset.GetReadOnlyStringValues(factorVariableTreeNode.VariableName);
    403403            }
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeSimplifier.cs

    r14238 r14243  
    837837      var groupedVarNodes = from node in subtrees.OfType<VariableTreeNodeBase>()
    838838                            let lag = (node is LaggedVariableTreeNode) ? ((LaggedVariableTreeNode)node).Lag : 0
    839                             let cat = (node is FactorVariableTreeNode) ? ((FactorVariableTreeNode)node).VariableValue : string.Empty
     839                            let cat = (node is BinaryFactorVariableTreeNode) ? ((BinaryFactorVariableTreeNode)node).VariableValue : string.Empty
    840840                            group node by node.VariableName + cat + lag into g
    841841                            select g;
     
    947947        return aVar.VariableName == bVar.VariableName;
    948948      }
    949       var aFactor = a as FactorVariableTreeNode;
    950       var bFactor = b as FactorVariableTreeNode;
     949      var aFactor = a as BinaryFactorVariableTreeNode;
     950      var bFactor = b as BinaryFactorVariableTreeNode;
    951951      if (aFactor != null && bFactor != null) {
    952952        return aFactor.VariableName == bFactor.VariableName &&
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r14238 r14243  
    219219        }
    220220      }
    221       foreach (var factorSymbol in grammar.Symbols.OfType<FactorVariable>()) {
     221      foreach (var factorSymbol in grammar.Symbols.OfType<BinaryFactorVariable>()) {
    222222        if (!factorSymbol.Fixed) {
    223223          factorSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<string>(x));
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisSolutionImpactValuesCalculator.cs

    r14232 r14243  
    4343      //optimization: constant nodes return always the same value
    4444      ConstantTreeNode constantNode = node as ConstantTreeNode;
    45       FactorVariableTreeNode factorNode = node as FactorVariableTreeNode;
     45      BinaryFactorVariableTreeNode factorNode = node as BinaryFactorVariableTreeNode;
    4646      if (constantNode != null) {
    4747        yield return constantNode.Value;
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariable.cs

    r14242 r14243  
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    3030  [StorableClass]
    31   [Item("FactorVariable", "Represents a categorical variable (comparable to factors as in R).")]
    32   public class FactorVariable : VariableBase {
     31  [Item("BinaryFactorVariable", "Represents a categorical variable (comparable to factors as in R) and it's value.")]
     32  public class BinaryFactorVariable : VariableBase {
    3333
    3434    private Dictionary<string, List<string>> variableValues;
     
    4747
    4848    [StorableConstructor]
    49     protected FactorVariable(bool deserializing)
     49    protected BinaryFactorVariable(bool deserializing)
    5050      : base(deserializing) {
    5151      variableValues = new Dictionary<string, List<string>>();
    5252    }
    53     protected FactorVariable(FactorVariable original, Cloner cloner)
     53    protected BinaryFactorVariable(BinaryFactorVariable original, Cloner cloner)
    5454      : base(original, cloner) {
    5555      variableValues =
    5656        original.variableValues.ToDictionary(kvp => kvp.Key, kvp => new List<string>(kvp.Value));
    5757    }
    58     public FactorVariable() : this("FactorVariable", "Represents a categorical variable (comparable to factors as in R).") { }
    59     public FactorVariable(string name, string description)
     58    public BinaryFactorVariable() : this("BinaryFactorVariable", "Represents a categorical variable (comparable to factors as in R) and it's value.") { }
     59    public BinaryFactorVariable(string name, string description)
    6060      : base(name, description) {
    6161      variableValues = new Dictionary<string, List<string>>();
     
    6767
    6868    public override IDeepCloneable Clone(Cloner cloner) {
    69       return new FactorVariable(this, cloner);
     69      return new BinaryFactorVariable(this, cloner);
    7070    }
    7171
  • branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Symbols/BinaryFactorVariableTreeNode.cs

    r14242 r14243  
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
    24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2524using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2625using HeuristicLab.Random;
    2726namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    2827  [StorableClass]
    29   public class FactorVariableTreeNode : VariableTreeNodeBase {
    30     public new FactorVariable Symbol {
    31       get { return (FactorVariable)base.Symbol; }
     28  public class BinaryFactorVariableTreeNode : VariableTreeNodeBase {
     29    public new BinaryFactorVariable Symbol {
     30      get { return (BinaryFactorVariable)base.Symbol; }
    3231    }
    3332
     
    4039
    4140    [StorableConstructor]
    42     protected FactorVariableTreeNode(bool deserializing) : base(deserializing) { }
    43     protected FactorVariableTreeNode(FactorVariableTreeNode original, Cloner cloner)
     41    protected BinaryFactorVariableTreeNode(bool deserializing) : base(deserializing) { }
     42    protected BinaryFactorVariableTreeNode(BinaryFactorVariableTreeNode original, Cloner cloner)
    4443      : base(original, cloner) {
    4544      variableValue = original.variableValue;
    4645    }
    47     protected FactorVariableTreeNode() { }
    48     public FactorVariableTreeNode(FactorVariable variableSymbol) : base(variableSymbol) { }
     46    protected BinaryFactorVariableTreeNode() { }
     47    public BinaryFactorVariableTreeNode(BinaryFactorVariable variableSymbol) : base(variableSymbol) { }
    4948
    5049    public override bool HasLocalParameters {
     
    7372
    7473    public override IDeepCloneable Clone(Cloner cloner) {
    75       return new FactorVariableTreeNode(this, cloner);
     74      return new BinaryFactorVariableTreeNode(this, cloner);
    7675    }
    7776
Note: See TracChangeset for help on using the changeset viewer.