- Timestamp:
- 09/15/11 16:12:10 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r6740 r6769 415 415 if (actualRow < 0 || actualRow >= dataset.Rows) 416 416 return double.NaN; 417 return ((IList<double>)currentInstr.iArg0)[ row] * laggedVariableTreeNode.Weight;417 return ((IList<double>)currentInstr.iArg0)[actualRow] * laggedVariableTreeNode.Weight; 418 418 } 419 419 case OpCodes.Constant: { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tests/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs
r6755 r6769 292 292 Evaluate(interpreter, ds, "(mean -1.0 1.0 -1.0)", 0, -1.0 / 3.0); 293 293 294 // lag 295 Evaluate(interpreter, ds, "(lagVariable 1.0 a -1) ", 1, ds.GetDoubleValue("A", 0)); 296 Evaluate(interpreter, ds, "(lagVariable 1.0 a -1) ", 2, ds.GetDoubleValue("A", 1)); 297 Evaluate(interpreter, ds, "(lagVariable 1.0 a 0) ", 2, ds.GetDoubleValue("A", 2)); 298 Evaluate(interpreter, ds, "(lagVariable 1.0 a 1) ", 0, ds.GetDoubleValue("A", 1)); 294 299 } 295 300 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tests/SymbolicExpressionImporter.cs
r5809 r6769 29 29 internal class SymbolicExpressionImporter { 30 30 private const string VARSTART = "VAR"; 31 private const string LAGGEDVARSTART = "LAG"; 31 32 private const string DEFUNSTART = "DEFUN"; 32 33 private const string ARGSTART = "ARG"; … … 58 59 Constant constant = new Constant(); 59 60 Variable variable = new Variable(); 61 LaggedVariable laggedVariable = new LaggedVariable(); 60 62 Defun defun = new Defun(); 61 63 … … 96 98 if (tokens.Peek().StringValue.StartsWith(VARSTART)) { 97 99 tree = ParseVariable(tokens); 100 } else if (tokens.Peek().StringValue.StartsWith(LAGGEDVARSTART)) { 101 tree = ParseLaggedVariable(tokens); 98 102 } else if (tokens.Peek().StringValue.StartsWith(DEFUNSTART)) { 99 103 tree = ParseDefun(tokens); … … 157 161 } 158 162 163 private ISymbolicExpressionTreeNode ParseLaggedVariable(Queue<Token> tokens) { 164 Token varTok = tokens.Dequeue(); 165 Debug.Assert(varTok.StringValue == "LAGVARIABLE"); 166 LaggedVariableTreeNode t = (LaggedVariableTreeNode)laggedVariable.CreateTreeNode(); 167 t.Weight = tokens.Dequeue().DoubleValue; 168 t.VariableName = tokens.Dequeue().StringValue; 169 t.Lag = (int)tokens.Dequeue().DoubleValue; 170 return t; 171 } 172 159 173 private ISymbolicExpressionTreeNode CreateTree(Token token) { 160 174 if (token.Symbol != TokenSymbol.SYMB) throw new FormatException("Expected function symbol, but got: " + token.StringValue);
Note: See TracChangeset
for help on using the changeset viewer.