Changeset 14400 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs
- Timestamp:
- 11/17/16 15:41:33 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs
r14391 r14400 114 114 alglib.lrunpack(lm, out coefficients, out nFeatures); 115 115 116 var tree = LinearModelToTreeConverter.CreateTree( 117 variableNames: Enumerable.Repeat(problemData.TargetVariable, nFeatures).ToArray(), 118 lags: Enumerable.Range(0, timeOffset).Select(i => (i + 1) * -1).ToArray(), 119 coefficients: coefficients.Take(nFeatures).ToArray(), 120 @const: coefficients[nFeatures] 121 ); 116 117 ISymbolicExpressionTree tree = new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode()); 118 ISymbolicExpressionTreeNode startNode = new StartSymbol().CreateTreeNode(); 119 tree.Root.AddSubtree(startNode); 120 ISymbolicExpressionTreeNode addition = new Addition().CreateTreeNode(); 121 startNode.AddSubtree(addition); 122 123 for (int i = 0; i < timeOffset; i++) { 124 LaggedVariableTreeNode node = (LaggedVariableTreeNode)new LaggedVariable().CreateTreeNode(); 125 node.VariableName = targetVariable; 126 node.Weight = coefficients[i]; 127 node.Lag = (i + 1) * -1; 128 addition.AddSubtree(node); 129 } 130 131 ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode(); 132 cNode.Value = coefficients[coefficients.Length - 1]; 133 addition.AddSubtree(cNode); 122 134 123 135 var interpreter = new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter(problemData.TargetVariable);
Note: See TracChangeset
for help on using the changeset viewer.