Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5467 for trunk/sources


Ignore:
Timestamp:
02/15/11 14:30:55 (14 years ago)
Author:
gkronber
Message:

#1325: Merged r5060 from branch into trunk.

Location:
trunk/sources
Files:
11 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Problems.DataAnalysis

  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionProblemBase.cs

    r5445 r5467  
    282282        varSymbol.VariableNames = DataAnalysisProblemData.InputVariables.CheckedItems.Select(x => x.Value.Value);
    283283      }
     284      foreach (var varSymbol in FunctionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.VariableCondition>()) {
     285        varSymbol.VariableNames = DataAnalysisProblemData.InputVariables.CheckedItems.Select(x => x.Value.Value);
     286      }
    284287      var globalGrammar = FunctionTreeGrammar as GlobalSymbolicExpressionGrammar;
    285288      if (globalGrammar != null) {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLab.Problems.DataAnalysis.Views-3.3.csproj

    r5373 r5467  
    199199      <DependentUpon>ConstantView.cs</DependentUpon>
    200200    </Compile>
     201    <Compile Include="Symbolic\Symbols\VariableConditionView.cs">
     202      <SubType>UserControl</SubType>
     203    </Compile>
     204    <Compile Include="Symbolic\Symbols\VariableConditionView.Designer.cs">
     205      <DependentUpon>VariableConditionView.cs</DependentUpon>
     206    </Compile>
    201207    <Compile Include="Symbolic\Symbols\LaggedVariableView.cs">
    202208      <SubType>UserControl</SubType>
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj

    r5431 r5467  
    116116    <Compile Include="Symbolic\TypeCoherentExpressionGrammar.cs" />
    117117    <Compile Include="Symbolic\Symbols\Power.cs" />
     118    <Compile Include="Symbolic\Symbols\VariableCondition.cs" />
     119    <Compile Include="Symbolic\Symbols\VariableConditionTreeNode.cs" />
    118120    <Compile Include="TableFileParser.cs" />
    119121    <None Include="HeuristicLab.snk" />
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs

    r5445 r5467  
    7272      derivative.InitialFrequency = 0.0;
    7373
     74      var variableCondition = new VariableCondition();
     75      variableCondition.InitialFrequency = 0.0;
     76
    7477      var constant = new Constant();
    7578      constant.MinValue = -20;
     
    7982      laggedVariable.InitialFrequency = 0.0;
    8083
    81       var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, root, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable };
     84      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, root, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable, variableCondition };
    8285      var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not, timeLag, integral, derivative };
    8386
    84       var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt };
     87      var binaryFunctionSymbols = new List<Symbol>() { pow, root, gt, lt, variableCondition };
    8588      var functionSymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or };
    8689      var terminalSymbols = new List<Symbol>() { variableSymbol, constant, laggedVariable };
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs

    r5445 r5467  
    129129      public const byte Integral = 25;
    130130      public const byte Derivative = 26;
     131
     132      public const byte VariableCondition = 27;
    131133    }
    132134
     
    158160      { typeof(Integral), OpCodes.Integral},
    159161      { typeof(Derivative), OpCodes.Derivative},
     162      { typeof(VariableCondition),OpCodes.VariableCondition}
    160163    };
    161164
     
    193196          instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName);
    194197          code[i] = instr;
     198        } else if (instr.opCode == OpCodes.VariableCondition) {
     199          var variableConditionTreeNode = instr.dynamicNode as VariableConditionTreeNode;
     200          instr.iArg0 = (ushort)dataset.GetVariableIndex(variableConditionTreeNode.VariableName);
    195201        }
    196202      }
     
    201207        state.Reset();
    202208        yield return Evaluate(dataset, ref row, state);
    203       }
     209      } 
    204210    }
    205211
     
    398404            return constTreeNode.Value;
    399405          }
     406
     407        //mkommend: this symbol uses the logistic function f(x) = 1 / (1 + e^(-alpha * x) )
     408        //to determine the relative amounts of the true and false branch see http://en.wikipedia.org/wiki/Logistic_function
     409        case OpCodes.VariableCondition: {
     410            var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode;
     411            double variableValue = dataset[row, currentInstr.iArg0];
     412            double x = variableValue - variableConditionTreeNode.Threshold;
     413            double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
     414
     415            double trueBranch = Evaluate(dataset, ref row, state);
     416            double falseBranch = Evaluate(dataset, ref row, state);
     417
     418            return trueBranch * p + falseBranch * (1 - p);
     419          }
    400420        default: throw new NotSupportedException();
    401421      }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableCondition.cs

    r5060 r5467  
    168168      : base(name, description) {
    169169      thresholdInitializerMu = 0.0;
    170       thresholdInitializerSigma = 1.0;
     170      thresholdInitializerSigma = 0.1;
    171171      thresholdManipulatorMu = 0.0;
    172       thresholdManipulatorSigma = 1.0;
     172      thresholdManipulatorSigma = 0.1;
    173173
    174174      variableNames = new List<string>();
    175175
    176176      slopeInitializerMu = 1.0;
    177       slopeInitializerSigma = 0.5;
     177      slopeInitializerSigma = 0.05;
    178178      slopeManipulatorMu = 0.0;
    179       slopeManipulatorSigma = 0.5;
     179      slopeManipulatorSigma = 0.05;
    180180    }
    181181
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs

    r5445 r5467  
    5555
    5656    public override bool HasLocalParameters {
    57       get {
    58         return true;
    59       }
     57      get { return true; }
    6058    }
    6159
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/TypeCoherentExpressionGrammar.cs

    r5445 r5467  
    7272      var derivative = new Derivative();
    7373      derivative.InitialFrequency = 0.0;
     74      var variableCondition = new VariableCondition();
     75      variableCondition.InitialFrequency = 0.0;
    7476
    7577      var constant = new Constant();
     
    9193       *   UnaryOperator RealValueExpression |
    9294       *   "IF" BooleanExpression RealValueExpression RealValueExpression |
     95       *   "VariableCondition" RealValueExpression RealValueExpression
    9396       *
    9497       * BinaryOperator =
     
    106109       */
    107110
    108       var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, root, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable };
     111      var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, pow, root, exp, @if, gt, lt, and, or, not, timeLag, integral, derivative, constant, variableSymbol, laggedVariable, variableCondition };
    109112
    110113      var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, timeLag, integral, derivative };
    111       var binaryFunctionSymbols = new List<Symbol>() { add, sub, mul, div, mean, pow, root };
     114      var binaryFunctionSymbols = new List<Symbol>() { add, sub, mul, div, mean, pow, root, variableCondition };
    112115
    113116      var unaryBooleanFunctionSymbols = new List<Symbol>() { not };
  • trunk/sources/HeuristicLab.Problems.VehicleRouting

  • trunk/sources/HeuristicLab.Problems.VehicleRouting.Views

Note: See TracChangeset for help on using the changeset viewer.