- Timestamp:
- 04/04/17 17:52:44 (8 years ago)
- Location:
- trunk/sources
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs
r14185 r14826 83 83 public const byte Erf = 43; 84 84 public const byte Bessel = 44; 85 public const byte FactorVariable = 46; 86 public const byte BinaryFactorVariable = 47; 87 85 88 86 89 private static Dictionary<Type, byte> symbolToOpcode = new Dictionary<Type, byte>() { … … 130 133 { typeof(Norm), OpCodes.Norm}, 131 134 { typeof(Erf), OpCodes.Erf}, 132 { typeof(Bessel), OpCodes.Bessel} 135 { typeof(Bessel), OpCodes.Bessel}, 136 { typeof(FactorVariable), OpCodes.FactorVariable }, 137 { typeof(BinaryFactorVariable), OpCodes.BinaryFactorVariable } 133 138 }; 134 139 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
r14809 r14826 66 66 private static MethodInfo erf = thisType.GetMethod("Erf", new Type[] { typeof(double) }); 67 67 private static MethodInfo bessel = thisType.GetMethod("Bessel", new Type[] { typeof(double) }); 68 private static MethodInfo string_eq = typeof(string).GetMethod("Equals", new Type[] { typeof(string) }); 68 69 #endregion 69 70 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r14345 r14826 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; … … 143 144 var variableTreeNode = (VariableTreeNode)instr.dynamicNode; 144 145 instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName); 146 } else if (instr.opCode == OpCodes.FactorVariable) { 147 var factorTreeNode = instr.dynamicNode as FactorVariableTreeNode; 148 instr.data = dataset.GetReadOnlyStringValues(factorTreeNode.VariableName); 149 } else if (instr.opCode == OpCodes.BinaryFactorVariable) { 150 var factorTreeNode = instr.dynamicNode as BinaryFactorVariableTreeNode; 151 instr.data = dataset.GetReadOnlyStringValues(factorTreeNode.VariableName); 145 152 } else if (instr.opCode == OpCodes.LagVariable) { 146 153 var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode; … … 455 462 return ((IList<double>)currentInstr.data)[row] * variableTreeNode.Weight; 456 463 } 464 case OpCodes.BinaryFactorVariable: { 465 if (row < 0 || row >= dataset.Rows) return double.NaN; 466 var factorVarTreeNode = currentInstr.dynamicNode as BinaryFactorVariableTreeNode; 467 return ((IList<string>)currentInstr.data)[row] == factorVarTreeNode.VariableValue ? factorVarTreeNode.Weight : 0; 468 } 469 case OpCodes.FactorVariable: { 470 if (row < 0 || row >= dataset.Rows) return double.NaN; 471 var factorVarTreeNode = currentInstr.dynamicNode as FactorVariableTreeNode; 472 return factorVarTreeNode.GetValue(((IList<string>)currentInstr.data)[row]); 473 } 457 474 case OpCodes.LagVariable: { 458 475 var laggedVariableTreeNode = (LaggedVariableTreeNode)currentInstr.dynamicNode; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs
r14345 r14826 149 149 var variableTreeNode = (VariableTreeNode)instr.dynamicNode; 150 150 instr.value = ((IList<double>)instr.data)[row] * variableTreeNode.Weight; 151 } 152 } else if (instr.opCode == OpCodes.BinaryFactorVariable) { 153 if (row < 0 || row >= dataset.Rows) instr.value = double.NaN; 154 else { 155 var factorTreeNode = instr.dynamicNode as BinaryFactorVariableTreeNode; 156 instr.value = ((IList<string>)instr.data)[row] == factorTreeNode.VariableValue ? factorTreeNode.Weight : 0; 157 } 158 } else if (instr.opCode == OpCodes.FactorVariable) { 159 if (row < 0 || row >= dataset.Rows) instr.value = double.NaN; 160 else { 161 var factorTreeNode = instr.dynamicNode as FactorVariableTreeNode; 162 instr.value = factorTreeNode.GetValue(((IList<string>)instr.data)[row]); 151 163 } 152 164 } else if (instr.opCode == OpCodes.LagVariable) { … … 403 415 } 404 416 break; 417 case OpCodes.BinaryFactorVariable: { 418 var factorVariableTreeNode = instr.dynamicNode as BinaryFactorVariableTreeNode; 419 instr.data = dataset.GetReadOnlyStringValues(factorVariableTreeNode.VariableName); 420 } 421 break; 422 case OpCodes.FactorVariable: { 423 var factorVariableTreeNode = instr.dynamicNode as FactorVariableTreeNode; 424 instr.data = dataset.GetReadOnlyStringValues(factorVariableTreeNode.VariableName); 425 } 426 break; 405 427 case OpCodes.LagVariable: { 406 428 var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
Note: See TracChangeset
for help on using the changeset viewer.