Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/06/17 11:12:18 (7 years ago)
Author:
gkronber
Message:

#2697: merged r14843 (resolving conflicts in csproj file for HL.Algorithms.DataAnalysis because MCTS has been removed)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/TimeSeries/AutoregressiveModeling.cs

    r15061 r15142  
    115115      alglib.lrunpack(lm, out coefficients, out nFeatures);
    116116
    117 
    118       ISymbolicExpressionTree tree = new SymbolicExpressionTree(new ProgramRootSymbol().CreateTreeNode());
    119       ISymbolicExpressionTreeNode startNode = new StartSymbol().CreateTreeNode();
    120       tree.Root.AddSubtree(startNode);
    121       ISymbolicExpressionTreeNode addition = new Addition().CreateTreeNode();
    122       startNode.AddSubtree(addition);
    123 
    124       for (int i = 0; i < timeOffset; i++) {
    125         LaggedVariableTreeNode node = (LaggedVariableTreeNode)new LaggedVariable().CreateTreeNode();
    126         node.VariableName = targetVariable;
    127         node.Weight = coefficients[i];
    128         node.Lag = (i + 1) * -1;
    129         addition.AddSubtree(node);
    130       }
    131 
    132       ConstantTreeNode cNode = (ConstantTreeNode)new Constant().CreateTreeNode();
    133       cNode.Value = coefficients[coefficients.Length - 1];
    134       addition.AddSubtree(cNode);
     117      var tree = LinearModelToTreeConverter.CreateTree(
     118        variableNames: Enumerable.Repeat(problemData.TargetVariable, nFeatures).ToArray(),
     119        lags: Enumerable.Range(0, timeOffset).Select(i => (i + 1) * -1).ToArray(),
     120        coefficients: coefficients.Take(nFeatures).ToArray(),
     121        @const: coefficients[nFeatures]
     122        );
    135123
    136124      var interpreter = new SymbolicTimeSeriesPrognosisExpressionTreeInterpreter(problemData.TargetVariable);
Note: See TracChangeset for help on using the changeset viewer.