Changeset 11203 for branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter
- Timestamp:
- 07/18/14 12:35:00 (11 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll11 10 HeuristicLab 3.3.5.1.ReSharper.user 12 11 HeuristicLab 3.3.6.0.ReSharper.user 13 12 HeuristicLab.4.5.resharper.user 14 13 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development16 14 HeuristicLab.resharper.user 17 15 ProtoGen.exe … … 19 17 _ReSharper.HeuristicLab 20 18 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests22 19 _ReSharper.HeuristicLab.ExtLibs 23 20 bin 24 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/InterpreterState.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 46 46 public const byte OR = 14; 47 47 public const byte NOT = 15; 48 public const byte XOR = 45;49 48 50 49 … … 100 99 { typeof(Or), OpCodes.OR }, 101 100 { typeof(Not), OpCodes.NOT}, 102 { typeof(Xor),OpCodes.XOR},103 101 { typeof(Average), OpCodes.Average}, 104 102 { typeof(InvokeFunction), OpCodes.Call }, -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 168 168 if (instr.opCode == OpCodes.Variable) { 169 169 var variableTreeNode = (VariableTreeNode)instr.dynamicNode; 170 instr. data= doubleVariableNames[variableTreeNode.VariableName];170 instr.iArg0 = doubleVariableNames[variableTreeNode.VariableName]; 171 171 } else if (instr.opCode == OpCodes.LagVariable) { 172 172 var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode; 173 instr. data= doubleVariableNames[laggedVariableTreeNode.VariableName];173 instr.iArg0 = doubleVariableNames[laggedVariableTreeNode.VariableName]; 174 174 } else if (instr.opCode == OpCodes.VariableCondition) { 175 175 var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode; 176 instr. data= doubleVariableNames[variableConditionTreeNode.VariableName];176 instr.iArg0 = doubleVariableNames[variableConditionTreeNode.VariableName]; 177 177 } else if (instr.opCode == OpCodes.Call) { 178 178 necessaryArgStackSize += instr.nArguments + 1; … … 449 449 return; 450 450 } 451 case OpCodes.XOR: {452 CompileInstructions(il, state, ds);453 il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0);454 il.Emit(System.Reflection.Emit.OpCodes.Cgt);// > 0455 456 for (int i = 1; i < nArgs; i++) {457 CompileInstructions(il, state, ds);458 il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4_0);459 il.Emit(System.Reflection.Emit.OpCodes.Cgt);// > 0460 il.Emit(System.Reflection.Emit.OpCodes.Xor);461 }462 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 2.0); // * 2463 il.Emit(System.Reflection.Emit.OpCodes.Mul);464 il.Emit(System.Reflection.Emit.OpCodes.Ldc_R8, 1.0); // - 1465 il.Emit(System.Reflection.Emit.OpCodes.Sub);466 return;467 }468 451 case OpCodes.GT: { 469 452 CompileInstructions(il, state, ds); … … 583 566 VariableTreeNode varNode = (VariableTreeNode)currentInstr.dynamicNode; 584 567 il.Emit(System.Reflection.Emit.OpCodes.Ldarg_1); // load columns array 585 il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, (int)currentInstr. data);568 il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, (int)currentInstr.iArg0); 586 569 // load correct column of the current variable 587 570 il.Emit(System.Reflection.Emit.OpCodes.Ldelem_Ref); … … 617 600 LaggedVariableTreeNode varNode = (LaggedVariableTreeNode)currentInstr.dynamicNode; 618 601 il.Emit(System.Reflection.Emit.OpCodes.Ldarg_1); // load columns array 619 il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, (int)currentInstr. data);602 il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, (int)currentInstr.iArg0); 620 603 // load correct column of the current variable 621 604 il.Emit(System.Reflection.Emit.OpCodes.Ldelem_Ref); -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 117 117 if (instr.opCode == OpCodes.Variable) { 118 118 var variableTreeNode = (VariableTreeNode)instr.dynamicNode; 119 instr. data= dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);119 instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName); 120 120 } else if (instr.opCode == OpCodes.LagVariable) { 121 121 var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode; 122 instr. data= dataset.GetReadOnlyDoubleValues(laggedVariableTreeNode.VariableName);122 instr.iArg0 = dataset.GetReadOnlyDoubleValues(laggedVariableTreeNode.VariableName); 123 123 } else if (instr.opCode == OpCodes.VariableCondition) { 124 124 var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode; 125 instr. data= dataset.GetReadOnlyDoubleValues(variableConditionTreeNode.VariableName);125 instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableConditionTreeNode.VariableName); 126 126 } else if (instr.opCode == OpCodes.Call) { 127 127 necessaryArgStackSize += instr.nArguments + 1; … … 132 132 133 133 134 p ublicvirtual double Evaluate(Dataset dataset, ref int row, InterpreterState state) {134 protected virtual double Evaluate(Dataset dataset, ref int row, InterpreterState state) { 135 135 Instruction currentInstr = state.NextInstruction(); 136 136 switch (currentInstr.opCode) { … … 343 343 case OpCodes.NOT: { 344 344 return Evaluate(dataset, ref row, state) > 0.0 ? -1.0 : 1.0; 345 }346 case OpCodes.XOR: {347 //mkommend: XOR on multiple inputs is defined as true if the number of positive signals is odd348 // this is equal to a consecutive execution of binary XOR operations.349 int positiveSignals = 0;350 for (int i = 0; i < currentInstr.nArguments; i++) {351 if (Evaluate(dataset, ref row, state) > 0.0) positiveSignals++;352 }353 return positiveSignals % 2 != 0 ? 1.0 : -1.0;354 345 } 355 346 case OpCodes.GT: { … … 415 406 int savedPc = state.ProgramCounter; 416 407 // set pc to start of function 417 state.ProgramCounter = (ushort)currentInstr. data;408 state.ProgramCounter = (ushort)currentInstr.iArg0; 418 409 // evaluate the function 419 410 double v = Evaluate(dataset, ref row, state); … … 427 418 } 428 419 case OpCodes.Arg: { 429 return state.GetStackFrameValue((ushort)currentInstr. data);420 return state.GetStackFrameValue((ushort)currentInstr.iArg0); 430 421 } 431 422 case OpCodes.Variable: { 432 423 if (row < 0 || row >= dataset.Rows) return double.NaN; 433 424 var variableTreeNode = (VariableTreeNode)currentInstr.dynamicNode; 434 return ((IList<double>)currentInstr. data)[row] * variableTreeNode.Weight;425 return ((IList<double>)currentInstr.iArg0)[row] * variableTreeNode.Weight; 435 426 } 436 427 case OpCodes.LagVariable: { … … 438 429 int actualRow = row + laggedVariableTreeNode.Lag; 439 430 if (actualRow < 0 || actualRow >= dataset.Rows) return double.NaN; 440 return ((IList<double>)currentInstr. data)[actualRow] * laggedVariableTreeNode.Weight;431 return ((IList<double>)currentInstr.iArg0)[actualRow] * laggedVariableTreeNode.Weight; 441 432 } 442 433 case OpCodes.Constant: { … … 450 441 if (row < 0 || row >= dataset.Rows) return double.NaN; 451 442 var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode; 452 double variableValue = ((IList<double>)currentInstr. data)[row];443 double variableValue = ((IList<double>)currentInstr.iArg0)[row]; 453 444 double x = variableValue - variableConditionTreeNode.Threshold; 454 445 double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
Note: See TracChangeset
for help on using the changeset viewer.