Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9976 for stable


Ignore:
Timestamp:
09/16/13 19:56:42 (11 years ago)
Author:
gkronber
Message:

#2021: merged linear interpreter for symbolic data analysis solutions to stable (r9828,r9830,r9837,r9840,r9871,r9944)

Location:
stable
Files:
17 edited
3 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Common/3.3/Cloner.cs

    r9456 r9976  
    6767    }
    6868
     69    /// <summary>
     70    /// Returns the clone of an deeply cloned item, if it was already cloned.
     71    /// </summary>
     72    /// <param name="original">The original object.</param>
     73    /// <returns>The clone of the given object, if it was already cloned; null otherwise</returns>
     74    public IDeepCloneable GetClone(IDeepCloneable original) {
     75      IDeepCloneable clone = null;
     76      mapping.TryGetValue(original, out clone);
     77      return clone;
     78    }
     79
    6980  }
    7081}
  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/Instruction.cs

    r9456 r9976  
    3131    public byte nArguments;
    3232    // an optional object value (addresses for calls, argument index for arguments)
    33     public object iArg0;
     33    public object data;
    3434  }
    3535}
  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/SymbolicExpressionTreeCompiler.cs

    r9456 r9976  
    5252        if (instr.dynamicNode.Symbol is InvokeFunction) {
    5353          var invokeNode = (InvokeFunctionTreeNode)instr.dynamicNode;
    54           instr.iArg0 = entryPoint[invokeNode.Symbol.FunctionName];
     54          instr.data = entryPoint[invokeNode.Symbol.FunctionName];
    5555        }
    5656      }
     
    6868        if (node.Symbol is Argument) {
    6969          var argNode = (ArgumentTreeNode)node;
    70           instr.iArg0 = (ushort)argNode.Symbol.ArgumentIndex;
     70          instr.data = (ushort)argNode.Symbol.ArgumentIndex;
    7171        }
    7272        instr.dynamicNode = node;
  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj

    r9862 r9976  
    124124    <Compile Include="ArchitectureManipulators\SymbolicExpressionTreeArchitectureManipulator.cs" />
    125125    <Compile Include="Compiler\Instruction.cs" />
     126    <Compile Include="Compiler\LinearInstruction.cs" />
    126127    <Compile Include="Compiler\SymbolicExpressionTreeCompiler.cs" />
     128    <Compile Include="Compiler\SymbolicExpressionTreeLinearCompiler.cs" />
    127129    <Compile Include="Creators\FullTreeCreator.cs">
    128130      <SubType>Code</SubType>
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionSolutionImpactValuesCalculator.cs

    r9456 r9976  
    4949      var replacementValue = CalculateReplacementValue(regressionModel, node, regressionProblemData, rows);
    5050      var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue };
     51
    5152      var cloner = new Cloner();
    52       cloner.RegisterClonedObject(node, constantNode);
    5353      var tempModel = cloner.Clone(regressionModel);
     54      var tempModelNode = (ISymbolicExpressionTreeNode)cloner.GetClone(node);
     55
     56      var tempModelParentNode = tempModelNode.Parent;
     57      int i = tempModelParentNode.IndexOfSubtree(tempModelNode);
     58      tempModelParentNode.RemoveSubtree(i);
     59      tempModelParentNode.InsertSubtree(i, constantNode);
    5460
    5561      var estimatedValues = tempModel.GetEstimatedValues(dataset, rows);
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SymbolicTimeSeriesPrognosisExpressionTreeInterpreter.cs

    r9462 r9976  
    123123          var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
    124124          if (variableTreeNode.VariableName == targetVariable)
    125             instr.iArg0 = targetVariableCache;
     125            instr.data = targetVariableCache;
    126126          else
    127             instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
     127            instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
    128128        } else if (instr.opCode == OpCodes.LagVariable) {
    129129          var variableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
    130130          if (variableTreeNode.VariableName == targetVariable)
    131             instr.iArg0 = targetVariableCache;
     131            instr.data = targetVariableCache;
    132132          else
    133             instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
     133            instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
    134134        } else if (instr.opCode == OpCodes.VariableCondition) {
    135135          var variableTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
    136136          if (variableTreeNode.VariableName == targetVariable)
    137             instr.iArg0 = targetVariableCache;
     137            instr.data = targetVariableCache;
    138138          else
    139             instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
     139            instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
    140140        } else if (instr.opCode == OpCodes.Call) {
    141141          necessaryArgStackSize += instr.nArguments + 1;
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r9931 r9976  
    147147    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs" />
    148148    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeInterpreter.cs" />
     149    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs" />
    149150    <Compile Include="Plugin.cs" />
    150151    <Compile Include="Formatters\SymbolicDataAnalysisExpressionLatexFormatter.cs" />
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r9456 r9976  
    168168        if (instr.opCode == OpCodes.Variable) {
    169169          var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
    170           instr.iArg0 = doubleVariableNames[variableTreeNode.VariableName];
     170          instr.data = doubleVariableNames[variableTreeNode.VariableName];
    171171        } else if (instr.opCode == OpCodes.LagVariable) {
    172172          var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
    173           instr.iArg0 = doubleVariableNames[laggedVariableTreeNode.VariableName];
     173          instr.data = doubleVariableNames[laggedVariableTreeNode.VariableName];
    174174        } else if (instr.opCode == OpCodes.VariableCondition) {
    175175          var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
    176           instr.iArg0 = doubleVariableNames[variableConditionTreeNode.VariableName];
     176          instr.data = doubleVariableNames[variableConditionTreeNode.VariableName];
    177177        } else if (instr.opCode == OpCodes.Call) {
    178178          necessaryArgStackSize += instr.nArguments + 1;
     
    566566            VariableTreeNode varNode = (VariableTreeNode)currentInstr.dynamicNode;
    567567            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_1); // load columns array
    568             il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, (int)currentInstr.iArg0);
     568            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, (int)currentInstr.data);
    569569            // load correct column of the current variable
    570570            il.Emit(System.Reflection.Emit.OpCodes.Ldelem_Ref);
     
    600600            LaggedVariableTreeNode varNode = (LaggedVariableTreeNode)currentInstr.dynamicNode;
    601601            il.Emit(System.Reflection.Emit.OpCodes.Ldarg_1); // load columns array
    602             il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, (int)currentInstr.iArg0);
     602            il.Emit(System.Reflection.Emit.OpCodes.Ldc_I4, (int)currentInstr.data);
    603603            // load correct column of the current variable
    604604            il.Emit(System.Reflection.Emit.OpCodes.Ldelem_Ref);
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs

    r9456 r9976  
    117117        if (instr.opCode == OpCodes.Variable) {
    118118          var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
    119           instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
     119          instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
    120120        } else if (instr.opCode == OpCodes.LagVariable) {
    121121          var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
    122           instr.iArg0 = dataset.GetReadOnlyDoubleValues(laggedVariableTreeNode.VariableName);
     122          instr.data = dataset.GetReadOnlyDoubleValues(laggedVariableTreeNode.VariableName);
    123123        } else if (instr.opCode == OpCodes.VariableCondition) {
    124124          var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
    125           instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableConditionTreeNode.VariableName);
     125          instr.data = dataset.GetReadOnlyDoubleValues(variableConditionTreeNode.VariableName);
    126126        } else if (instr.opCode == OpCodes.Call) {
    127127          necessaryArgStackSize += instr.nArguments + 1;
     
    132132
    133133
    134     protected virtual double Evaluate(Dataset dataset, ref int row, InterpreterState state) {
     134    public virtual double Evaluate(Dataset dataset, ref int row, InterpreterState state) {
    135135      Instruction currentInstr = state.NextInstruction();
    136136      switch (currentInstr.opCode) {
     
    406406            int savedPc = state.ProgramCounter;
    407407            // set pc to start of function 
    408             state.ProgramCounter = (ushort)currentInstr.iArg0;
     408            state.ProgramCounter = (ushort)currentInstr.data;
    409409            // evaluate the function
    410410            double v = Evaluate(dataset, ref row, state);
     
    418418          }
    419419        case OpCodes.Arg: {
    420             return state.GetStackFrameValue((ushort)currentInstr.iArg0);
     420            return state.GetStackFrameValue((ushort)currentInstr.data);
    421421          }
    422422        case OpCodes.Variable: {
    423423            if (row < 0 || row >= dataset.Rows) return double.NaN;
    424424            var variableTreeNode = (VariableTreeNode)currentInstr.dynamicNode;
    425             return ((IList<double>)currentInstr.iArg0)[row] * variableTreeNode.Weight;
     425            return ((IList<double>)currentInstr.data)[row] * variableTreeNode.Weight;
    426426          }
    427427        case OpCodes.LagVariable: {
     
    429429            int actualRow = row + laggedVariableTreeNode.Lag;
    430430            if (actualRow < 0 || actualRow >= dataset.Rows) return double.NaN;
    431             return ((IList<double>)currentInstr.iArg0)[actualRow] * laggedVariableTreeNode.Weight;
     431            return ((IList<double>)currentInstr.data)[actualRow] * laggedVariableTreeNode.Weight;
    432432          }
    433433        case OpCodes.Constant: {
     
    441441            if (row < 0 || row >= dataset.Rows) return double.NaN;
    442442            var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode;
    443             double variableValue = ((IList<double>)currentInstr.iArg0)[row];
     443            double variableValue = ((IList<double>)currentInstr.data)[row];
    444444            double x = variableValue - variableConditionTreeNode.Threshold;
    445445            double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs

    r9828 r9976  
    118118      for (int i = code.Length - 1; i >= 0; --i) {
    119119        if (code[i].skip) continue;
    120         #region opcode switch
     120        #region opcode if
    121121        var instr = code[i];
    122         switch (instr.opCode) {
    123           case OpCodes.Variable: {
    124               if (row < 0 || row >= dataset.Rows) instr.value = double.NaN;
    125               var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
    126               instr.value = ((IList<double>)instr.data)[row] * variableTreeNode.Weight;
    127             }
    128             break;
    129           case OpCodes.LagVariable: {
    130               var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
    131               int actualRow = row + laggedVariableTreeNode.Lag;
    132               if (actualRow < 0 || actualRow >= dataset.Rows)
    133                 instr.value = double.NaN;
    134               else
    135                 instr.value = ((IList<double>)instr.data)[actualRow] * laggedVariableTreeNode.Weight;
    136             }
    137             break;
    138           case OpCodes.VariableCondition: {
    139               if (row < 0 || row >= dataset.Rows) instr.value = double.NaN;
    140               var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
    141               double variableValue = ((IList<double>)instr.data)[row];
    142               double x = variableValue - variableConditionTreeNode.Threshold;
    143               double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
    144 
    145               double trueBranch = code[instr.childIndex].value;
    146               double falseBranch = code[instr.childIndex + 1].value;
    147 
    148               instr.value = trueBranch * p + falseBranch * (1 - p);
    149             }
    150             break;
    151           case OpCodes.Add: {
    152               double s = code[instr.childIndex].value;
    153               for (int j = 1; j != instr.nArguments; ++j) {
    154                 s += code[instr.childIndex + j].value;
    155               }
    156               instr.value = s;
    157             }
    158             break;
    159           case OpCodes.Sub: {
    160               double s = code[instr.childIndex].value;
    161               for (int j = 1; j != instr.nArguments; ++j) {
    162                 s -= code[instr.childIndex + j].value;
    163               }
    164               if (instr.nArguments == 1) s = -s;
    165               instr.value = s;
    166             }
    167             break;
    168           case OpCodes.Mul: {
    169               double p = code[instr.childIndex].value;
    170               for (int j = 1; j != instr.nArguments; ++j) {
    171                 p *= code[instr.childIndex + j].value;
    172               }
    173               instr.value = p;
    174             }
    175             break;
    176           case OpCodes.Div: {
    177               double p = code[instr.childIndex].value;
    178               for (int j = 1; j != instr.nArguments; ++j) {
    179                 p /= code[instr.childIndex + j].value;
    180               }
    181               if (instr.nArguments == 1) p = 1.0 / p;
    182               instr.value = p;
    183             }
    184             break;
    185           case OpCodes.Average: {
    186               double s = code[instr.childIndex].value;
    187               for (int j = 1; j != instr.nArguments; ++j) {
    188                 s += code[instr.childIndex + j].value;
    189               }
    190               instr.value = s / instr.nArguments;
    191             }
    192             break;
    193           case OpCodes.Cos: {
    194               instr.value = Math.Cos(code[instr.childIndex].value);
    195             }
    196             break;
    197           case OpCodes.Sin: {
    198               instr.value = Math.Sin(code[instr.childIndex].value);
    199             }
    200             break;
    201           case OpCodes.Tan: {
    202               instr.value = Math.Tan(code[instr.childIndex].value);
    203             }
    204             break;
    205           case OpCodes.Square: {
    206               instr.value = Math.Pow(code[instr.childIndex].value, 2);
    207             }
    208             break;
    209           case OpCodes.Power: {
    210               double x = code[instr.childIndex].value;
    211               double y = Math.Round(code[instr.childIndex + 1].value);
    212               instr.value = Math.Pow(x, y);
    213             }
    214             break;
    215           case OpCodes.SquareRoot: {
    216               instr.value = Math.Sqrt(code[instr.childIndex].value);
    217             }
    218             break;
    219           case OpCodes.Root: {
    220               double x = code[instr.childIndex].value;
    221               double y = code[instr.childIndex + 1].value;
    222               instr.value = Math.Pow(x, 1 / y);
    223             }
    224             break;
    225           case OpCodes.Exp: {
    226               instr.value = Math.Exp(code[instr.childIndex].value);
    227             }
    228             break;
    229           case OpCodes.Log: {
    230               instr.value = Math.Log(code[instr.childIndex].value);
    231             }
    232             break;
    233           case OpCodes.Gamma: {
    234               var x = code[instr.childIndex].value;
    235               instr.value = double.IsNaN(x) ? double.NaN : alglib.gammafunction(x);
    236             }
    237             break;
    238           case OpCodes.Psi: {
    239               var x = code[instr.childIndex].value;
    240               if (double.IsNaN(x)) instr.value = double.NaN;
    241               else if (x <= 0 && (Math.Floor(x) - x).IsAlmost(0)) instr.value = double.NaN;
    242               else instr.value = alglib.psi(x);
    243             }
    244             break;
    245           case OpCodes.Dawson: {
    246               var x = code[instr.childIndex].value;
    247               instr.value = double.IsNaN(x) ? double.NaN : alglib.dawsonintegral(x);
    248             }
    249             break;
    250           case OpCodes.ExponentialIntegralEi: {
    251               var x = code[instr.childIndex].value;
    252               instr.value = double.IsNaN(x) ? double.NaN : alglib.exponentialintegralei(x);
    253             }
    254             break;
    255           case OpCodes.SineIntegral: {
    256               double si, ci;
    257               var x = code[instr.childIndex].value;
    258               if (double.IsNaN(x)) instr.value = double.NaN;
    259               else {
    260                 alglib.sinecosineintegrals(x, out si, out ci);
    261                 instr.value = si;
    262               }
    263             }
    264             break;
    265           case OpCodes.CosineIntegral: {
    266               double si, ci;
    267               var x = code[instr.childIndex].value;
    268               if (double.IsNaN(x)) instr.value = double.NaN;
    269               else {
    270                 alglib.sinecosineintegrals(x, out si, out ci);
    271                 instr.value = ci;
    272               }
    273             }
    274             break;
    275           case OpCodes.HyperbolicSineIntegral: {
    276               double shi, chi;
    277               var x = code[instr.childIndex].value;
    278               if (double.IsNaN(x)) instr.value = double.NaN;
    279               else {
    280                 alglib.hyperbolicsinecosineintegrals(x, out shi, out chi);
    281                 instr.value = shi;
    282               }
    283             }
    284             break;
    285           case OpCodes.HyperbolicCosineIntegral: {
    286               double shi, chi;
    287               var x = code[instr.childIndex].value;
    288               if (double.IsNaN(x)) instr.value = double.NaN;
    289               else {
    290                 alglib.hyperbolicsinecosineintegrals(x, out shi, out chi);
    291                 instr.value = chi;
    292               }
    293             }
    294             break;
    295           case OpCodes.FresnelCosineIntegral: {
    296               double c = 0, s = 0;
    297               var x = code[instr.childIndex].value;
    298               if (double.IsNaN(x)) instr.value = double.NaN;
    299               else {
    300                 alglib.fresnelintegral(x, ref c, ref s);
    301                 instr.value = c;
    302               }
    303             }
    304             break;
    305           case OpCodes.FresnelSineIntegral: {
    306               double c = 0, s = 0;
    307               var x = code[instr.childIndex].value;
    308               if (double.IsNaN(x)) instr.value = double.NaN;
    309               else {
    310                 alglib.fresnelintegral(x, ref c, ref s);
    311                 instr.value = s;
    312               }
    313             }
    314             break;
    315           case OpCodes.AiryA: {
    316               double ai, aip, bi, bip;
    317               var x = code[instr.childIndex].value;
    318               if (double.IsNaN(x)) instr.value = double.NaN;
    319               else {
    320                 alglib.airy(x, out ai, out aip, out bi, out bip);
    321                 instr.value = ai;
    322               }
    323             }
    324             break;
    325           case OpCodes.AiryB: {
    326               double ai, aip, bi, bip;
    327               var x = code[instr.childIndex].value;
    328               if (double.IsNaN(x)) instr.value = double.NaN;
    329               else {
    330                 alglib.airy(x, out ai, out aip, out bi, out bip);
    331                 instr.value = bi;
    332               }
    333             }
    334             break;
    335           case OpCodes.Norm: {
    336               var x = code[instr.childIndex].value;
    337               if (double.IsNaN(x)) instr.value = double.NaN;
    338               else instr.value = alglib.normaldistribution(x);
    339             }
    340             break;
    341           case OpCodes.Erf: {
    342               var x = code[instr.childIndex].value;
    343               if (double.IsNaN(x)) instr.value = double.NaN;
    344               else instr.value = alglib.errorfunction(x);
    345             }
    346             break;
    347           case OpCodes.Bessel: {
    348               var x = code[instr.childIndex].value;
    349               if (double.IsNaN(x)) instr.value = double.NaN;
    350               else instr.value = alglib.besseli0(x);
    351             }
    352             break;
    353           case OpCodes.IfThenElse: {
    354               double condition = code[instr.childIndex].value;
    355               double result;
    356               if (condition > 0.0) {
    357                 result = code[instr.childIndex + 1].value;
    358               } else {
    359                 result = code[instr.childIndex + 2].value;
    360               }
    361               instr.value = result;
    362             }
    363             break;
    364           case OpCodes.AND: {
    365               double result = code[instr.childIndex].value;
    366               for (int j = 1; j < instr.nArguments; j++) {
    367                 if (result > 0.0) result = code[instr.childIndex + j].value;
    368                 else break;
    369               }
    370               instr.value = result > 0.0 ? 1.0 : -1.0;
    371             }
    372             break;
    373           case OpCodes.OR: {
    374               double result = code[instr.childIndex].value;
    375               for (int j = 1; j < instr.nArguments; j++) {
    376                 if (result <= 0.0) result = code[instr.childIndex + j].value;
    377                 else break;
    378               }
    379               instr.value = result > 0.0 ? 1.0 : -1.0;
    380             }
    381             break;
    382           case OpCodes.NOT: {
    383               instr.value = code[instr.childIndex].value > 0.0 ? -1.0 : 1.0;
    384             }
    385             break;
    386           case OpCodes.GT: {
    387               double x = code[instr.childIndex].value;
    388               double y = code[instr.childIndex + 1].value;
    389               instr.value = x > y ? 1.0 : -1.0;
    390             }
    391             break;
    392           case OpCodes.LT: {
    393               double x = code[instr.childIndex].value;
    394               double y = code[instr.childIndex + 1].value;
    395               instr.value = x < y ? 1.0 : -1.0;
    396             }
    397             break;
    398           case OpCodes.TimeLag:
    399           case OpCodes.Integral:
    400           case OpCodes.Derivative: {
    401               var state = (InterpreterState)instr.data;
    402               state.Reset();
    403               instr.value = interpreter.Evaluate(dataset, ref row, state);
    404             }
    405             break;
    406           default:
    407             var errorText = string.Format("The {0} symbol is not supported by the linear interpreter. To support this symbol, please use the SymbolicDataAnalysisExpressionTreeInterpreter.", instr.dynamicNode.Symbol.Name);
    408             throw new NotSupportedException(errorText);
     122        if (instr.opCode == OpCodes.Variable) {
     123          if (row < 0 || row >= dataset.Rows) instr.value = double.NaN;
     124          var variableTreeNode = (VariableTreeNode)instr.dynamicNode;
     125          instr.value = ((IList<double>)instr.data)[row] * variableTreeNode.Weight;
     126        } else if (instr.opCode == OpCodes.LagVariable) {
     127          var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
     128          int actualRow = row + laggedVariableTreeNode.Lag;
     129          if (actualRow < 0 || actualRow >= dataset.Rows)
     130            instr.value = double.NaN;
     131          else
     132            instr.value = ((IList<double>)instr.data)[actualRow] * laggedVariableTreeNode.Weight;
     133        } else if (instr.opCode == OpCodes.VariableCondition) {
     134          if (row < 0 || row >= dataset.Rows) instr.value = double.NaN;
     135          var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
     136          double variableValue = ((IList<double>)instr.data)[row];
     137          double x = variableValue - variableConditionTreeNode.Threshold;
     138          double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x));
     139
     140          double trueBranch = code[instr.childIndex].value;
     141          double falseBranch = code[instr.childIndex + 1].value;
     142
     143          instr.value = trueBranch * p + falseBranch * (1 - p);
     144        } else if (instr.opCode == OpCodes.Add) {
     145          double s = code[instr.childIndex].value;
     146          for (int j = 1; j != instr.nArguments; ++j) {
     147            s += code[instr.childIndex + j].value;
     148          }
     149          instr.value = s;
     150        } else if (instr.opCode == OpCodes.Sub) {
     151          double s = code[instr.childIndex].value;
     152          for (int j = 1; j != instr.nArguments; ++j) {
     153            s -= code[instr.childIndex + j].value;
     154          }
     155          if (instr.nArguments == 1) s = -s;
     156          instr.value = s;
     157        } else if (instr.opCode == OpCodes.Mul) {
     158          double p = code[instr.childIndex].value;
     159          for (int j = 1; j != instr.nArguments; ++j) {
     160            p *= code[instr.childIndex + j].value;
     161          }
     162          instr.value = p;
     163        } else if (instr.opCode == OpCodes.Div) {
     164          double p = code[instr.childIndex].value;
     165          for (int j = 1; j != instr.nArguments; ++j) {
     166            p /= code[instr.childIndex + j].value;
     167          }
     168          if (instr.nArguments == 1) p = 1.0 / p;
     169          instr.value = p;
     170        } else if (instr.opCode == OpCodes.Average) {
     171          double s = code[instr.childIndex].value;
     172          for (int j = 1; j != instr.nArguments; ++j) {
     173            s += code[instr.childIndex + j].value;
     174          }
     175          instr.value = s / instr.nArguments;
     176        } else if (instr.opCode == OpCodes.Cos) {
     177          instr.value = Math.Cos(code[instr.childIndex].value);
     178        } else if (instr.opCode == OpCodes.Sin) {
     179          instr.value = Math.Sin(code[instr.childIndex].value);
     180        } else if (instr.opCode == OpCodes.Tan) {
     181          instr.value = Math.Tan(code[instr.childIndex].value);
     182        } else if (instr.opCode == OpCodes.Square) {
     183          instr.value = Math.Pow(code[instr.childIndex].value, 2);
     184        } else if (instr.opCode == OpCodes.Power) {
     185          double x = code[instr.childIndex].value;
     186          double y = Math.Round(code[instr.childIndex + 1].value);
     187          instr.value = Math.Pow(x, y);
     188        } else if (instr.opCode == OpCodes.SquareRoot) {
     189          instr.value = Math.Sqrt(code[instr.childIndex].value);
     190        } else if (instr.opCode == OpCodes.Root) {
     191          double x = code[instr.childIndex].value;
     192          double y = code[instr.childIndex + 1].value;
     193          instr.value = Math.Pow(x, 1 / y);
     194        } else if (instr.opCode == OpCodes.Exp) {
     195          instr.value = Math.Exp(code[instr.childIndex].value);
     196        } else if (instr.opCode == OpCodes.Log) {
     197          instr.value = Math.Log(code[instr.childIndex].value);
     198        } else if (instr.opCode == OpCodes.Gamma) {
     199          var x = code[instr.childIndex].value;
     200          instr.value = double.IsNaN(x) ? double.NaN : alglib.gammafunction(x);
     201        } else if (instr.opCode == OpCodes.Psi) {
     202          var x = code[instr.childIndex].value;
     203          if (double.IsNaN(x)) instr.value = double.NaN;
     204          else if (x <= 0 && (Math.Floor(x) - x).IsAlmost(0)) instr.value = double.NaN;
     205          else instr.value = alglib.psi(x);
     206        } else if (instr.opCode == OpCodes.Dawson) {
     207          var x = code[instr.childIndex].value;
     208          instr.value = double.IsNaN(x) ? double.NaN : alglib.dawsonintegral(x);
     209        } else if (instr.opCode == OpCodes.ExponentialIntegralEi) {
     210          var x = code[instr.childIndex].value;
     211          instr.value = double.IsNaN(x) ? double.NaN : alglib.exponentialintegralei(x);
     212        } else if (instr.opCode == OpCodes.SineIntegral) {
     213          double si, ci;
     214          var x = code[instr.childIndex].value;
     215          if (double.IsNaN(x)) instr.value = double.NaN;
     216          else {
     217            alglib.sinecosineintegrals(x, out si, out ci);
     218            instr.value = si;
     219          }
     220        } else if (instr.opCode == OpCodes.CosineIntegral) {
     221          double si, ci;
     222          var x = code[instr.childIndex].value;
     223          if (double.IsNaN(x)) instr.value = double.NaN;
     224          else {
     225            alglib.sinecosineintegrals(x, out si, out ci);
     226            instr.value = ci;
     227          }
     228        } else if (instr.opCode == OpCodes.HyperbolicSineIntegral) {
     229          double shi, chi;
     230          var x = code[instr.childIndex].value;
     231          if (double.IsNaN(x)) instr.value = double.NaN;
     232          else {
     233            alglib.hyperbolicsinecosineintegrals(x, out shi, out chi);
     234            instr.value = shi;
     235          }
     236        } else if (instr.opCode == OpCodes.HyperbolicCosineIntegral) {
     237          double shi, chi;
     238          var x = code[instr.childIndex].value;
     239          if (double.IsNaN(x)) instr.value = double.NaN;
     240          else {
     241            alglib.hyperbolicsinecosineintegrals(x, out shi, out chi);
     242            instr.value = chi;
     243          }
     244        } else if (instr.opCode == OpCodes.FresnelCosineIntegral) {
     245          double c = 0, s = 0;
     246          var x = code[instr.childIndex].value;
     247          if (double.IsNaN(x)) instr.value = double.NaN;
     248          else {
     249            alglib.fresnelintegral(x, ref c, ref s);
     250            instr.value = c;
     251          }
     252        } else if (instr.opCode == OpCodes.FresnelSineIntegral) {
     253          double c = 0, s = 0;
     254          var x = code[instr.childIndex].value;
     255          if (double.IsNaN(x)) instr.value = double.NaN;
     256          else {
     257            alglib.fresnelintegral(x, ref c, ref s);
     258            instr.value = s;
     259          }
     260        } else if (instr.opCode == OpCodes.AiryA) {
     261          double ai, aip, bi, bip;
     262          var x = code[instr.childIndex].value;
     263          if (double.IsNaN(x)) instr.value = double.NaN;
     264          else {
     265            alglib.airy(x, out ai, out aip, out bi, out bip);
     266            instr.value = ai;
     267          }
     268        } else if (instr.opCode == OpCodes.AiryB) {
     269          double ai, aip, bi, bip;
     270          var x = code[instr.childIndex].value;
     271          if (double.IsNaN(x)) instr.value = double.NaN;
     272          else {
     273            alglib.airy(x, out ai, out aip, out bi, out bip);
     274            instr.value = bi;
     275          }
     276        } else if (instr.opCode == OpCodes.Norm) {
     277          var x = code[instr.childIndex].value;
     278          if (double.IsNaN(x)) instr.value = double.NaN;
     279          else instr.value = alglib.normaldistribution(x);
     280        } else if (instr.opCode == OpCodes.Erf) {
     281          var x = code[instr.childIndex].value;
     282          if (double.IsNaN(x)) instr.value = double.NaN;
     283          else instr.value = alglib.errorfunction(x);
     284        } else if (instr.opCode == OpCodes.Bessel) {
     285          var x = code[instr.childIndex].value;
     286          if (double.IsNaN(x)) instr.value = double.NaN;
     287          else instr.value = alglib.besseli0(x);
     288        } else if (instr.opCode == OpCodes.IfThenElse) {
     289          double condition = code[instr.childIndex].value;
     290          double result;
     291          if (condition > 0.0) {
     292            result = code[instr.childIndex + 1].value;
     293          } else {
     294            result = code[instr.childIndex + 2].value;
     295          }
     296          instr.value = result;
     297        } else if (instr.opCode == OpCodes.AND) {
     298          double result = code[instr.childIndex].value;
     299          for (int j = 1; j < instr.nArguments; j++) {
     300            if (result > 0.0) result = code[instr.childIndex + j].value;
     301            else break;
     302          }
     303          instr.value = result > 0.0 ? 1.0 : -1.0;
     304        } else if (instr.opCode == OpCodes.OR) {
     305          double result = code[instr.childIndex].value;
     306          for (int j = 1; j < instr.nArguments; j++) {
     307            if (result <= 0.0) result = code[instr.childIndex + j].value;
     308            else break;
     309          }
     310          instr.value = result > 0.0 ? 1.0 : -1.0;
     311        } else if (instr.opCode == OpCodes.NOT) {
     312          instr.value = code[instr.childIndex].value > 0.0 ? -1.0 : 1.0;
     313        } else if (instr.opCode == OpCodes.GT) {
     314          double x = code[instr.childIndex].value;
     315          double y = code[instr.childIndex + 1].value;
     316          instr.value = x > y ? 1.0 : -1.0;
     317        } else if (instr.opCode == OpCodes.LT) {
     318          double x = code[instr.childIndex].value;
     319          double y = code[instr.childIndex + 1].value;
     320          instr.value = x < y ? 1.0 : -1.0;
     321        } else if (instr.opCode == OpCodes.TimeLag || instr.opCode == OpCodes.Derivative || instr.opCode == OpCodes.Integral) {
     322          var state = (InterpreterState)instr.data;
     323          state.Reset();
     324          instr.value = interpreter.Evaluate(dataset, ref row, state);
     325        } else {
     326          var errorText = string.Format("The {0} symbol is not supported by the linear interpreter. To support this symbol, please use the SymbolicDataAnalysisExpressionTreeInterpreter.", instr.dynamicNode.Symbol.Name);
     327          throw new NotSupportedException(errorText);
    409328        }
    410329        #endregion
     
    414333
    415334    private static LinearInstruction[] GetPrefixSequence(LinearInstruction[] code, int startIndex) {
     335      var s = new Stack<int>();
    416336      var list = new List<LinearInstruction>();
    417       int i = startIndex;
    418       while (i != code.Length) {
     337      s.Push(startIndex);
     338      while (s.Any()) {
     339        int i = s.Pop();
    419340        var instr = code[i];
     341        // push instructions in reverse execution order
     342        for (int j = instr.nArguments - 1; j >= 0; j--) s.Push(instr.childIndex + j);
    420343        list.Add(instr);
    421         i = instr.nArguments > 0 ? instr.childIndex : i + 1;
    422344      }
    423345      return list.ToArray();
  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r9456 r9976  
    196196
    197197      SymbolicExpressionTreeGrammar = new TypeCoherentExpressionGrammar();
    198       SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeInterpreter();
     198      SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter();
    199199
    200200      FitnessCalculationPartition.Start = ProblemData.TrainingPartition.Start;
  • stable/HeuristicLab.Tests

  • stable/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs

    r9885 r9976  
    3030
    3131
    32   [TestClass()]
     32  [TestClass]
    3333  public class SymbolicDataAnalysisExpressionTreeInterpreterTest {
    3434    private const int N = 1000;
    3535    private const int Rows = 1000;
    3636    private const int Columns = 50;
    37     private TestContext testContextInstance;
    38 
    39     /// <summary>
    40     ///Gets or sets the test context which provides
    41     ///information about and functionality for the current test run.
    42     ///</summary>
    43     public TestContext TestContext {
    44       get {
    45         return testContextInstance;
    46       }
    47       set {
    48         testContextInstance = value;
    49       }
    50     }
    51 
    52     [TestMethod]
    53     [TestCategory("Problems.DataAnalysis")]
    54     [TestProperty("Time", "long")]
    55     public void SymbolicDataAnalysisExpressionTreeInterpreterTypeCoherentGrammarPerformanceTest() {
    56       TypeCoherentGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
    57     }
    58 
    59     [TestMethod]
    60     [TestCategory("Problems.DataAnalysis")]
    61     [TestProperty("Time", "long")]
    62     public void SymbolicDataAnalysisExpressionTreeInterpreterFullGrammarPerformanceTest() {
    63       FullGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
    64     }
    65 
    66     [TestMethod]
    67     [TestCategory("Problems.DataAnalysis")]
    68     [TestProperty("Time", "long")]
    69     public void SymbolicDataAnalysisExpressionTreeInterpreterArithmeticGrammarPerformanceTest() {
    70       ArithmeticGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
    71     }
    72 
    73     [TestMethod]
    74     [TestCategory("Problems.DataAnalysis")]
    75     [TestProperty("Time", "long")]
    76     public void SymbolicDataAnalysisExpressionTreeILEmittingInterpreterTypeCoherentGrammarPerformanceTest() {
    77       TypeCoherentGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
    78     }
    79 
    80     [TestMethod]
    81     [TestCategory("Problems.DataAnalysis")]
    82     [TestProperty("Time", "long")]
    83     public void SymbolicDataAnalysisExpressionTreeILEmittingInterpreterFullGrammarPerformanceTest() {
    84       FullGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
    85     }
    86 
    87     [TestCategory("Problems.DataAnalysis")]
    88     [TestProperty("Time", "long")]
    89     [TestMethod]
    90     public void SymbolicDataAnalysisExpressionTreeILEmittingInterpreterArithmeticGrammarPerformanceTest() {
    91       ArithmeticGrammarPerformanceTest(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
    92     }
    93 
    94     private void TypeCoherentGrammarPerformanceTest(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     37
     38    private static Dataset ds = new Dataset(new string[] { "Y", "A", "B" }, new double[,] {
     39        { 1.0, 1.0, 1.0 },
     40        { 2.0, 2.0, 2.0 },
     41        { 3.0, 1.0, 2.0 },
     42        { 4.0, 1.0, 1.0 },
     43        { 5.0, 2.0, 2.0 },
     44        { 6.0, 1.0, 2.0 },
     45        { 7.0, 1.0, 1.0 },
     46        { 8.0, 2.0, 2.0 },
     47        { 9.0, 1.0, 2.0 },
     48        { 10.0, 1.0, 1.0 },
     49        { 11.0, 2.0, 2.0 },
     50        { 12.0, 1.0, 2.0 }
     51      });
     52
     53    [TestMethod]
     54    [TestCategory("Problems.DataAnalysis.Symbolic")]
     55    [TestProperty("Time", "long")]
     56    public void StandardInterpreterTestTypeCoherentGrammarPerformance() {
     57      TestTypeCoherentGrammarPerformance(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
     58    }
     59    [TestMethod]
     60    [TestCategory("Problems.DataAnalysis.Symbolic")]
     61    [TestProperty("Time", "long")]
     62    public void StandardInterpreterTestFullGrammarPerformance() {
     63      TestFullGrammarPerformance(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
     64    }
     65    [TestMethod]
     66    [TestCategory("Problems.DataAnalysis.Symbolic")]
     67    [TestProperty("Time", "long")]
     68    public void StandardInterpreterTestArithmeticGrammarPerformance() {
     69      TestArithmeticGrammarPerformance(new SymbolicDataAnalysisExpressionTreeInterpreter(), 12.5e6);
     70    }
     71
     72
     73    [TestMethod]
     74    [TestCategory("Problems.DataAnalysis.Symbolic")]
     75    [TestProperty("Time", "long")]
     76    public void ILEmittingInterpreterTestTypeCoherentGrammarPerformance() {
     77      TestTypeCoherentGrammarPerformance(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
     78    }
     79    [TestMethod]
     80    [TestCategory("Problems.DataAnalysis.Symbolic")]
     81    [TestProperty("Time", "long")]
     82    public void ILEmittingInterpreterTestFullGrammarPerformance() {
     83      TestFullGrammarPerformance(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
     84    }
     85    [TestMethod]
     86    [TestCategory("Problems.DataAnalysis.Symbolic")]
     87    [TestProperty("Time", "long")]
     88    public void ILEmittingInterpreterTestArithmeticGrammarPerformance() {
     89      TestArithmeticGrammarPerformance(new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter(), 7.5e6);
     90    }
     91
     92
     93    [TestMethod]
     94    [TestCategory("Problems.DataAnalysis.Symbolic")]
     95    [TestProperty("Time", "long")]
     96    public void LinearInterpreterTestTypeCoherentGrammarPerformance() {
     97      TestTypeCoherentGrammarPerformance(new SymbolicDataAnalysisExpressionTreeLinearInterpreter(), 12.5e6);
     98    }
     99    [TestMethod]
     100    [TestCategory("Problems.DataAnalysis.Symbolic")]
     101    [TestProperty("Time", "long")]
     102    public void LinearInterpreterTestFullGrammarPerformance() {
     103      TestFullGrammarPerformance(new SymbolicDataAnalysisExpressionTreeLinearInterpreter(), 12.5e6);
     104    }
     105    [TestMethod]
     106    [TestCategory("Problems.DataAnalysis.Symbolic")]
     107    [TestProperty("Time", "long")]
     108    public void LinearInterpreterTestArithmeticGrammarPerformance() {
     109      TestArithmeticGrammarPerformance(new SymbolicDataAnalysisExpressionTreeLinearInterpreter(), 12.5e6);
     110    }
     111
     112    private void TestTypeCoherentGrammarPerformance(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    95113      var twister = new MersenneTwister(31415);
    96114      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    110128    }
    111129
    112     private void FullGrammarPerformanceTest(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     130    private void TestFullGrammarPerformance(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    113131      var twister = new MersenneTwister(31415);
    114132      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    127145    }
    128146
    129     private void ArithmeticGrammarPerformanceTest(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     147    private void TestArithmeticGrammarPerformance(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    130148      var twister = new MersenneTwister(31415);
    131149      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    150168    ///</summary>
    151169    [TestMethod]
    152     [TestCategory("Problems.DataAnalysis")]
     170    [TestCategory("Problems.DataAnalysis.Symbolic")]
    153171    [TestProperty("Time", "short")]
    154     public void SymbolicDataAnalysisExpressionTreeInterpreterEvaluateTest() {
    155       Dataset ds = new Dataset(new string[] { "Y", "A", "B" }, new double[,] {
    156         { 1.0, 1.0, 1.0 },
    157         { 2.0, 2.0, 2.0 },
    158         { 3.0, 1.0, 2.0 },
    159         { 4.0, 1.0, 1.0 },
    160         { 5.0, 2.0, 2.0 },
    161         { 6.0, 1.0, 2.0 },
    162         { 7.0, 1.0, 1.0 },
    163         { 8.0, 2.0, 2.0 },
    164         { 9.0, 1.0, 2.0 },
    165         { 10.0, 1.0, 1.0 },
    166         { 11.0, 2.0, 2.0 },
    167         { 12.0, 1.0, 2.0 }
    168       });
    169 
     172    public void StandardInterpreterTestEvaluation() {
    170173      var interpreter = new SymbolicDataAnalysisExpressionTreeInterpreter();
    171174      EvaluateTerminals(interpreter, ds);
     
    175178
    176179    [TestMethod]
    177     [TestCategory("Problems.DataAnalysis")]
     180    [TestCategory("Problems.DataAnalysis.Symbolic")]
    178181    [TestProperty("Time", "short")]
    179     public void SymbolicDataAnalysisExpressionILEmittingTreeInterpreterEvaluateTest() {
    180       Dataset ds = new Dataset(new string[] { "Y", "A", "B" }, new double[,] {
    181         { 1.0, 1.0, 1.0 },
    182         { 2.0, 2.0, 2.0 },
    183         { 3.0, 1.0, 2.0 },
    184         { 4.0, 1.0, 1.0 },
    185         { 5.0, 2.0, 2.0 },
    186         { 6.0, 1.0, 2.0 },
    187         { 7.0, 1.0, 1.0 },
    188         { 8.0, 2.0, 2.0 },
    189         { 9.0, 1.0, 2.0 },
    190         { 10.0, 1.0, 1.0 },
    191         { 11.0, 2.0, 2.0 },
    192         { 12.0, 1.0, 2.0 }
    193       });
    194 
     182    public void ILEmittingInterpreterTestEvaluation() {
    195183      var interpreter = new SymbolicDataAnalysisExpressionTreeILEmittingInterpreter();
     184      EvaluateTerminals(interpreter, ds);
     185      EvaluateOperations(interpreter, ds);
     186    }
     187
     188    [TestMethod]
     189    [TestCategory("Problems.DataAnalysis.Symbolic")]
     190    [TestProperty("Time", "short")]
     191    public void LinearInterpreterTestEvaluation() {
     192      var interpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter();
     193
     194      //ADFs are not supported by the linear interpreter
    196195      EvaluateTerminals(interpreter, ds);
    197196      EvaluateOperations(interpreter, ds);
     
    430429          try {
    431430            Evaluate(interpreter, ds, "(psi " + x + ")", 0, alglib.psi(x));
    432           } catch (alglib.alglibexception) { // ignore cases where alglib throws an exception
     431          }
     432          catch (alglib.alglibexception) { // ignore cases where alglib throws an exception
    433433          }
    434434        };
  • stable/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs

    r9885 r9976  
    3737
    3838    [TestMethod]
    39     [TestCategory("Problems.DataAnalysis")]
     39    [TestCategory("Problems.DataAnalysis.Symbolic")]
    4040    [TestProperty("Time", "long")]
    41     public void SymbolicTimeSeriesPrognosisTreeInterpreterTypeCoherentGrammarPerformanceTest() {
    42       TypeCoherentGrammarPerformanceTest(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
     41    public void TimeSeriesPrognosisInterpreterTestTypeCoherentGrammarPerformance() {
     42      TestTypeCoherentGrammarPerformance(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
    4343    }
    4444
    4545    [TestMethod]
    46     [TestCategory("Problems.DataAnalysis")]
     46    [TestCategory("Problems.DataAnalysis.Symbolic")]
    4747    [TestProperty("Time", "long")]
    48     public void SymbolicTimeSeriesPrognosisTreeInterpreterFullGrammarPerformanceTest() {
    49       FullGrammarPerformanceTest(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
     48    public void TimeSeriesPrognosisInterpreterTestFullGrammarPerformance() {
     49      TestFullGrammarPerformance(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
    5050    }
    5151
    5252    [TestMethod]
    53     [TestCategory("Problems.DataAnalysis")]
     53    [TestCategory("Problems.DataAnalysis.Symbolic")]
    5454    [TestProperty("Time", "long")]
    55     public void SymbolicTimeSeriesPrognosisTreeInterpreterArithmeticGrammarPerformanceTest() {
    56       ArithmeticGrammarPerformanceTest(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
    57     }
    58 
    59     private void TypeCoherentGrammarPerformanceTest(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     55    public void TimeSeriesPrognosisInterpreterTestArithmeticGrammarPerformance() {
     56      TestArithmeticGrammarPerformance(new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter("y"), 12.5e6);
     57    }
     58
     59    private void TestTypeCoherentGrammarPerformance(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    6060      var twister = new MersenneTwister(31415);
    6161      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    7575    }
    7676
    77     private void FullGrammarPerformanceTest(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     77    private void TestFullGrammarPerformance(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    7878      var twister = new MersenneTwister(31415);
    7979      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    9292    }
    9393
    94     private void ArithmeticGrammarPerformanceTest(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
     94    private void TestArithmeticGrammarPerformance(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, double nodesPerSecThreshold) {
    9595      var twister = new MersenneTwister(31415);
    9696      var dataset = Util.CreateRandomDataset(twister, Rows, Columns);
     
    115115    ///</summary>
    116116    [TestMethod]
    117     [TestCategory("Problems.DataAnalysis")]
     117    [TestCategory("Problems.DataAnalysis.Symbolic")]
    118118    [TestProperty("Time", "short")]
    119     public void SymbolicDataAnalysisExpressionTreeInterpreterEvaluateTest() {
     119    public void TimeSeriesPrognosisInterpreterTestEvaluation() {
    120120      Dataset ds = new Dataset(new string[] { "Y", "A", "B" }, new double[,] {
    121121        { 1.0, 1.0, 1.0 },
Note: See TracChangeset for help on using the changeset viewer.