- Timestamp:
- 12/07/10 14:11:12 (14 years ago)
- Location:
- branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj
r5051 r5060 156 156 <Compile Include="Symbolic\Symbols\Derivative.cs" /> 157 157 <Compile Include="Symbolic\Symbols\Integral.cs" /> 158 <Compile Include="Symbolic\Symbols\VariableCondition.cs" /> 159 <Compile Include="Symbolic\Symbols\VariableConditionTreeNode.cs" /> 158 160 <Compile Include="TableFileParser.cs" /> 159 161 <None Include="HeuristicLab.snk" /> -
branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/FullFunctionalExpressionGrammar.cs
r5051 r5060 60 60 var or = new Or(); 61 61 var not = new Not(); 62 62 63 var timeLag = new TimeLag(); 63 64 timeLag.InitialFrequency = 0.0; 64 65 var integral = new Integral(); 65 66 integral.InitialFrequency = 0.0; 66 var derivativ = new Derivative(); 67 derivativ.InitialFrequency = 0.0; 67 var derivative = new Derivative(); 68 derivative.InitialFrequency = 0.0; 69 70 var variableCondition = new VariableCondition(); 71 variableCondition.InitialFrequency = 0.0; 68 72 69 73 var constant = new Constant(); … … 74 78 laggedVariable.InitialFrequency = 0.0; 75 79 76 var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, exp, @if, gt, lt, and, or, not, timeLag, integral, derivativ, constant, variableSymbol, laggedVariable }; 77 var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not, timeLag, integral, derivativ }; 78 var binaryFunctionSymbols = new List<Symbol>() { gt, lt }; 80 var allSymbols = new List<Symbol>() { add, sub, mul, div, mean, sin, cos, tan, log, exp, @if, gt, lt, 81 and, or, not, timeLag, integral, derivative, variableCondition, constant, variableSymbol, laggedVariable }; 82 var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not, timeLag, integral, derivative }; 83 var binaryFunctionSymbols = new List<Symbol>() { gt, lt, variableCondition }; 79 84 var functionSymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or }; 80 85 var terminalSymbols = new List<Symbol>() { variableSymbol, constant, laggedVariable }; -
branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs
r5052 r5060 71 71 public const byte Integral = 23; 72 72 public const byte Derivative = 24; 73 74 public const byte VariableCondition = 25; 73 75 } 74 76 … … 97 99 { typeof(TimeLag), OpCodes.TimeLag}, 98 100 { typeof(Integral), OpCodes.Integral}, 99 { typeof(Derivative), OpCodes.Derivative} 101 { typeof(Derivative), OpCodes.Derivative}, 102 { typeof(VariableCondition),OpCodes.VariableCondition} 100 103 }; 101 104 private const int ARGUMENT_STACK_SIZE = 1024; … … 147 150 var variableTreeNode = instr.dynamicNode as LaggedVariableTreeNode; 148 151 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName); 152 } else if (instr.opCode == OpCodes.VariableCondition) { 153 var variableConditionTreeNode = instr.dynamicNode as VariableConditionTreeNode; 154 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableConditionTreeNode.VariableName); 149 155 } 150 156 return instr; … … 344 350 return (f_0 + 2 * f_1 - 2 * f_3 - f_4) / 8; // h = 1 345 351 } 352 353 //mkommend: this symbol uses the logistic function f(x) = 1 / (1 + e^(-alpha * x) ) 354 //to determine the relative amounts of the true and false branch see http://en.wikipedia.org/wiki/Logistic_function 355 case OpCodes.VariableCondition: { 356 var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode; 357 double variableValue = dataset[row, currentInstr.iArg0]; 358 double x = variableValue - variableConditionTreeNode.Threshold; 359 double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x)); 360 361 double trueBranch = Evaluate(); 362 double falseBranch = Evaluate(); 363 364 return trueBranch * p + falseBranch * (1 - p); 365 } 346 366 default: throw new NotSupportedException(); 347 367 } -
branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs
r4989 r5060 91 91 #endregion 92 92 [StorableConstructor] 93 protected Variable(bool deserializing) : base(deserializing) { 93 protected Variable(bool deserializing) 94 : base(deserializing) { 94 95 variableNames = new List<string>(); 95 96 } -
branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableTreeNode.cs
r4989 r5060 55 55 56 56 public override bool HasLocalParameters { 57 get { 58 return true; 59 } 57 get { return true; } 60 58 } 61 59
Note: See TracChangeset
for help on using the changeset viewer.