Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/13/12 15:35:22 (13 years ago)
Author:
mkommend
Message:

#1081: Corrected time series interpreter and updated visualizations.

Location:
branches/HeuristicLab.TimeSeries
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveMeanSquaredErrorEvaluator.cs

    r7989 r7998  
    6262
    6363    public static double Calculate(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, ITimeSeriesPrognosisProblemData problemData, IEnumerable<int> rows, int horizon, bool applyLinearScaling) {
    64       IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows.SelectMany(r => Enumerable.Range(r, horizon)));
    65       IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows, horizon).SelectMany(x => x);
     64      int horizion2 = problemData.TrainingPartition.End - problemData.TrainingPartition.Start;
     65      IEnumerable<double> targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows.Take(1).Select(r => Enumerable.Range(r, horizion2)).First());
     66      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows.Take(1), horizion2).SelectMany(x => x);
    6667      IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
    6768      OnlineCalculatorError errorState;
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SymbolicTimeSeriesPrognosisExpressionTreeInterpreter.cs

    r7991 r7998  
    8686        int row = rowsEnumerator.Current;
    8787        int horizon = horizonsEnumerator.Current;
     88        double[] vProgs = new double[horizon];
    8889
    89         double[] vProgs = new double[horizon];
    9090        for (int i = 0; i < horizon; i++) {
    9191          int localRow = i + row; // create a local variable for the ref parameter
     
    9595          state.Reset();
    9696        }
    97 
    9897        yield return vProgs;
    9998
     
    121120            instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
    122121        } else if (instr.opCode == OpCodes.LagVariable) {
    123           var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
    124           instr.iArg0 = dataset.GetReadOnlyDoubleValues(laggedVariableTreeNode.VariableName);
     122          var variableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode;
     123          if (variableTreeNode.VariableName == TargetVariable)
     124            instr.iArg0 = targetVariableCache;
     125          else
     126            instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
    125127        } else if (instr.opCode == OpCodes.VariableCondition) {
    126           var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
    127           instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableConditionTreeNode.VariableName);
     128          var variableTreeNode = (VariableConditionTreeNode)instr.dynamicNode;
     129          if (variableTreeNode.VariableName == TargetVariable)
     130            instr.iArg0 = targetVariableCache;
     131          else
     132            instr.iArg0 = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);
    128133        } else if (instr.opCode == OpCodes.Call) {
    129134          necessaryArgStackSize += instr.nArguments + 1;
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionLineChartView.cs

    r7989 r7998  
    214214        }
    215215      } else if (Content != null) {
    216         string targetVariable = Content.ProblemData.TargetVariable;
    217 
    218216        IEnumerable<int> indizes = null;
    219217        IEnumerable<double> predictedValues = null;
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis/TimeSeriesPrognosisSolutionPrognosedValuesView.cs

    r7989 r7998  
    124124      matrix.ColumnNames = columnNames.ToArray();
    125125      matrix.SortableView = true;
     126      matrixView.Content = matrix;
    126127    }
    127128    #endregion
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TimeSeries/TimeSeriesPrognosisInstanceProvider.cs

    r7989 r7998  
    2121
    2222using System;
    23 using System.Collections;
    2423using System.Collections.Generic;
    2524using System.IO;
     
    3736      Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
    3837      string targetVar = csvFileParser.VariableNames.Last();
    39 
    40       IEnumerable<string> allowedInputVars = csvFileParser.VariableNames.Where(x => !x.Equals(targetVar));
     38     
     39      IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar));
    4140
    4241      ITimeSeriesPrognosisProblemData regData = new TimeSeriesPrognosisProblemData(dataset, allowedInputVars, targetVar);
Note: See TracChangeset for help on using the changeset viewer.