Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9870


Ignore:
Timestamp:
08/07/13 17:00:16 (11 years ago)
Author:
bburlacu
Message:

#1837: Merged trunk changes and fixed sliding window visualization.

Location:
branches/Sliding Window GP
Files:
1 deleted
10 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic

  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/MenuItems/ExportSymbolicSolutionToExcelMenuItem.cs

    r9699 r9870  
    4444    }
    4545    public override IEnumerable<string> Structure {
    46       get { return new string[] { "&Edit" }; }
     46      get { return new string[] { "&Data Analysis" }; }
    4747    }
    4848    public override int Position {
    49       get { return 2500; }
     49      get { return 5200; }
    5050    }
    5151    public override string ToolTipText {
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowDataView.cs

    r9162 r9870  
    8989      chart.Series.Add(TARGETVARIABLE_SERIES_NAME);
    9090      chart.Series[TARGETVARIABLE_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    91       chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindY(Content.TargetValues.ToArray());
     91      var xValues = Enumerable.Range(Content.TrainingPartitionStart + 1, Content.TrainingPartitionEnd - Content.TrainingPartitionStart).ToArray();
     92      chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindXY(xValues, Content.TargetValues.ToArray());
    9293
    9394      if (Content.EstimatedValues.Any()) {
    9495        chart.Series.Add(ESTIMATEDVAlUES_SERIES_NAME);
    9596        chart.Series[ESTIMATEDVAlUES_SERIES_NAME].ChartType = SeriesChartType.FastLine;
    96         chart.Series[ESTIMATEDVAlUES_SERIES_NAME].Points.DataBindY(Content.EstimatedValues.ToArray());
     97        var yValues = Content.EstimatedValues.ToArray();
     98        chart.Series[ESTIMATEDVAlUES_SERIES_NAME].Points.DataBindXY(xValues, yValues);
    9799      }
    98100
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r9708 r9870  
    4141    <DebugType>full</DebugType>
    4242    <Optimize>false</Optimize>
    43     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     43    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    4444    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4545    <ErrorReport>prompt</ErrorReport>
     
    5858  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    5959    <DebugSymbols>true</DebugSymbols>
    60     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     60    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    6161    <DefineConstants>DEBUG;TRACE</DefineConstants>
    6262    <DebugType>full</DebugType>
     
    6666  </PropertyGroup>
    6767  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    68     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     68    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    6969    <DefineConstants>TRACE</DefineConstants>
    7070    <Optimize>true</Optimize>
     
    7676  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    7777    <DebugSymbols>true</DebugSymbols>
    78     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     78    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    7979    <DefineConstants>DEBUG;TRACE</DefineConstants>
    8080    <DebugType>full</DebugType>
     
    8484  </PropertyGroup>
    8585  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    86     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     86    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    8787    <DefineConstants>TRACE</DefineConstants>
    8888    <Optimize>true</Optimize>
     
    187187    <Compile Include="Crossovers\SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs" />
    188188    <Compile Include="Formatters\SymbolicDataAnalysisExpressionExcelFormatter.cs" />
    189     <Compile Include="Formatters\SymbolicExpressionTreeSmalltalkStringFormatter.cs" />
     189    <Compile Include="Formatters\SymbolicDataAnalysisExpressionSmalltalkFormatter.cs" />
    190190    <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionCrossover.cs" />
    191191    <Compile Include="Interfaces\ISymbolicDataAnalysisImpactValuesCalculator.cs" />
     
    194194    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs" />
    195195    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeInterpreter.cs" />
     196    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs" />
    196197    <Compile Include="Plugin.cs" />
    197198    <Compile Include="Formatters\SymbolicDataAnalysisExpressionLatexFormatter.cs" />
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs

    r9708 r9870  
    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);
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs

    r9708 r9870  
    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));
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowData.cs

    r9162 r9870  
    3232  [Item("Sliding Window Position", "")]
    3333  public sealed class SlidingWindowData : Item {
    34 
    3534    [Storable]
    3635    private IntRange slidingWindowPosition;
     
    3938    }
    4039
    41     [Storable]
    42     private IEnumerable<double> targetValues;
    4340    public IEnumerable<double> TargetValues {
    44       get { return targetValues; }
     41      get {
     42        return problemData.Dataset.GetDoubleValues(GetTargetVariableName(problemData), problemData.TrainingIndices);
     43      }
    4544    }
    4645
     
    5655    }
    5756
     57    [Storable]
     58    private readonly IDataAnalysisProblemData problemData;
     59
     60    public IDataAnalysisProblemData ProblemData {
     61      get { return problemData; }
     62    }
     63
     64    public int TrainingPartitionStart {
     65      get { return problemData.TrainingPartition.Start; }
     66    }
     67
     68    public int TrainingPartitionEnd {
     69      get { return problemData.TrainingPartition.End; }
     70    }
     71
    5872    [StorableConstructor]
    5973    private SlidingWindowData(bool deserializing) : base(deserializing) { }
     
    6175      : base(original, cloner) {
    6276      slidingWindowPosition = cloner.Clone(original.slidingWindowPosition);
    63       targetValues = new List<double>(original.targetValues);
     77      problemData = cloner.Clone(original.ProblemData);
    6478    }
    6579    public override IDeepCloneable Clone(Cloner cloner) {
     
    6781    }
    6882
    69     public SlidingWindowData(IntRange slidingWindowPosition, IEnumerable<double> targetValues)
     83    public SlidingWindowData(IntRange slidingWindowPosition, IDataAnalysisProblemData problemData)
    7084      : base() {
    7185      this.slidingWindowPosition = slidingWindowPosition;
    72       this.targetValues = targetValues.ToArray();
     86      this.problemData = (IDataAnalysisProblemData)problemData.Clone();
    7387    }
    7488
     
    7892      if (handler != null) EstimatedValuesChanged(this, EventArgs.Empty);
    7993    }
     94
     95    private string GetTargetVariableName(IDataAnalysisProblemData problemData) {
     96      var classificationProblemData = problemData as IClassificationProblemData;
     97      var regressionProblemData = problemData as IRegressionProblemData;
     98      string targetVariable;
     99      if (classificationProblemData != null) targetVariable = classificationProblemData.TargetVariable;
     100      else if (regressionProblemData != null) targetVariable = regressionProblemData.TargetVariable;
     101      else throw new NotSupportedException();
     102      return targetVariable;
     103    }
    80104  }
    81105}
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowVisualizer.cs

    r9707 r9870  
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    2423using System.Linq;
     
    7877      SlidingWindowData slidingWindowData;
    7978      if (!results.ContainsKey(SlidingWindowDataResultName)) {
    80         string targetVariable;
    81         var classificationProblemData = ProblemDataParameter.ActualValue as IClassificationProblemData;
    82         var regressionProblemData = ProblemDataParameter.ActualValue as IRegressionProblemData;
    83         if (classificationProblemData != null) targetVariable = classificationProblemData.TargetVariable;
    84         else if (regressionProblemData != null) targetVariable = regressionProblemData.TargetVariable;
    85         else throw new NotSupportedException();
    86 
    87         var targetData = ProblemDataParameter.ActualValue.Dataset.GetDoubleValues(targetVariable, ProblemDataParameter.ActualValue.TrainingIndices);
    88         slidingWindowData = new SlidingWindowData(FitnessCalculationPartitionParameter.ActualValue, targetData);
     79        slidingWindowData = new SlidingWindowData(FitnessCalculationPartitionParameter.ActualValue, ProblemDataParameter.ActualValue);
    8980        results.Add(new Result(SlidingWindowDataResultName, slidingWindowData));
    9081      } else slidingWindowData = (SlidingWindowData)results[SlidingWindowDataResultName].Value;
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r9708 r9870  
    196196
    197197      SymbolicExpressionTreeGrammar = new TypeCoherentExpressionGrammar();
    198       SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeInterpreter();
     198      SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter();
    199199
    200200      FitnessCalculationPartition.Start = ProblemData.TrainingPartition.Start;
Note: See TracChangeset for help on using the changeset viewer.