Changeset 9870
- Timestamp:
- 08/07/13 17:00:16 (11 years ago)
- Location:
- branches/Sliding Window GP
- Files:
-
- 1 deleted
- 10 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views merged: 9860
- Property svn:mergeinfo changed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/MenuItems/ExportSymbolicSolutionToExcelMenuItem.cs
r9699 r9870 44 44 } 45 45 public override IEnumerable<string> Structure { 46 get { return new string[] { "& Edit" }; }46 get { return new string[] { "&Data Analysis" }; } 47 47 } 48 48 public override int Position { 49 get { return 2500; }49 get { return 5200; } 50 50 } 51 51 public override string ToolTipText { -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowDataView.cs
r9162 r9870 89 89 chart.Series.Add(TARGETVARIABLE_SERIES_NAME); 90 90 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()); 92 93 93 94 if (Content.EstimatedValues.Any()) { 94 95 chart.Series.Add(ESTIMATEDVAlUES_SERIES_NAME); 95 96 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); 97 99 } 98 100 -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r9708 r9870 41 41 <DebugType>full</DebugType> 42 42 <Optimize>false</Optimize> 43 <OutputPath> $(SolutionDir)\bin\</OutputPath>43 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 44 44 <DefineConstants>DEBUG;TRACE</DefineConstants> 45 45 <ErrorReport>prompt</ErrorReport> … … 58 58 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> 59 59 <DebugSymbols>true</DebugSymbols> 60 <OutputPath> $(SolutionDir)\bin\</OutputPath>60 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 61 61 <DefineConstants>DEBUG;TRACE</DefineConstants> 62 62 <DebugType>full</DebugType> … … 66 66 </PropertyGroup> 67 67 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> 68 <OutputPath> $(SolutionDir)\bin\</OutputPath>68 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 69 69 <DefineConstants>TRACE</DefineConstants> 70 70 <Optimize>true</Optimize> … … 76 76 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 77 77 <DebugSymbols>true</DebugSymbols> 78 <OutputPath> $(SolutionDir)\bin\</OutputPath>78 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 79 79 <DefineConstants>DEBUG;TRACE</DefineConstants> 80 80 <DebugType>full</DebugType> … … 84 84 </PropertyGroup> 85 85 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> 86 <OutputPath> $(SolutionDir)\bin\</OutputPath>86 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 87 87 <DefineConstants>TRACE</DefineConstants> 88 88 <Optimize>true</Optimize> … … 187 187 <Compile Include="Crossovers\SymbolicDataAnalysisExpressionSemanticSimilarityCrossover.cs" /> 188 188 <Compile Include="Formatters\SymbolicDataAnalysisExpressionExcelFormatter.cs" /> 189 <Compile Include="Formatters\Symbolic ExpressionTreeSmalltalkStringFormatter.cs" />189 <Compile Include="Formatters\SymbolicDataAnalysisExpressionSmalltalkFormatter.cs" /> 190 190 <Compile Include="Interfaces\ISymbolicDataAnalysisExpressionCrossover.cs" /> 191 191 <Compile Include="Interfaces\ISymbolicDataAnalysisImpactValuesCalculator.cs" /> … … 194 194 <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs" /> 195 195 <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeInterpreter.cs" /> 196 <Compile Include="Interpreter\SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs" /> 196 197 <Compile Include="Plugin.cs" /> 197 198 <Compile Include="Formatters\SymbolicDataAnalysisExpressionLatexFormatter.cs" /> -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeILEmittingInterpreter.cs
r9708 r9870 168 168 if (instr.opCode == OpCodes.Variable) { 169 169 var variableTreeNode = (VariableTreeNode)instr.dynamicNode; 170 instr. iArg0= doubleVariableNames[variableTreeNode.VariableName];170 instr.data = doubleVariableNames[variableTreeNode.VariableName]; 171 171 } else if (instr.opCode == OpCodes.LagVariable) { 172 172 var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode; 173 instr. iArg0= doubleVariableNames[laggedVariableTreeNode.VariableName];173 instr.data = doubleVariableNames[laggedVariableTreeNode.VariableName]; 174 174 } else if (instr.opCode == OpCodes.VariableCondition) { 175 175 var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode; 176 instr. iArg0= doubleVariableNames[variableConditionTreeNode.VariableName];176 instr.data = doubleVariableNames[variableConditionTreeNode.VariableName]; 177 177 } else if (instr.opCode == OpCodes.Call) { 178 178 necessaryArgStackSize += instr.nArguments + 1; … … 566 566 VariableTreeNode varNode = (VariableTreeNode)currentInstr.dynamicNode; 567 567 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); 569 569 // load correct column of the current variable 570 570 il.Emit(System.Reflection.Emit.OpCodes.Ldelem_Ref); … … 600 600 LaggedVariableTreeNode varNode = (LaggedVariableTreeNode)currentInstr.dynamicNode; 601 601 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); 603 603 // load correct column of the current variable 604 604 il.Emit(System.Reflection.Emit.OpCodes.Ldelem_Ref); -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeInterpreter.cs
r9708 r9870 117 117 if (instr.opCode == OpCodes.Variable) { 118 118 var variableTreeNode = (VariableTreeNode)instr.dynamicNode; 119 instr. iArg0= dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName);119 instr.data = dataset.GetReadOnlyDoubleValues(variableTreeNode.VariableName); 120 120 } else if (instr.opCode == OpCodes.LagVariable) { 121 121 var laggedVariableTreeNode = (LaggedVariableTreeNode)instr.dynamicNode; 122 instr. iArg0= dataset.GetReadOnlyDoubleValues(laggedVariableTreeNode.VariableName);122 instr.data = dataset.GetReadOnlyDoubleValues(laggedVariableTreeNode.VariableName); 123 123 } else if (instr.opCode == OpCodes.VariableCondition) { 124 124 var variableConditionTreeNode = (VariableConditionTreeNode)instr.dynamicNode; 125 instr. iArg0= dataset.GetReadOnlyDoubleValues(variableConditionTreeNode.VariableName);125 instr.data = dataset.GetReadOnlyDoubleValues(variableConditionTreeNode.VariableName); 126 126 } else if (instr.opCode == OpCodes.Call) { 127 127 necessaryArgStackSize += instr.nArguments + 1; … … 132 132 133 133 134 p rotectedvirtual double Evaluate(Dataset dataset, ref int row, InterpreterState state) {134 public virtual double Evaluate(Dataset dataset, ref int row, InterpreterState state) { 135 135 Instruction currentInstr = state.NextInstruction(); 136 136 switch (currentInstr.opCode) { … … 406 406 int savedPc = state.ProgramCounter; 407 407 // set pc to start of function 408 state.ProgramCounter = (ushort)currentInstr. iArg0;408 state.ProgramCounter = (ushort)currentInstr.data; 409 409 // evaluate the function 410 410 double v = Evaluate(dataset, ref row, state); … … 418 418 } 419 419 case OpCodes.Arg: { 420 return state.GetStackFrameValue((ushort)currentInstr. iArg0);420 return state.GetStackFrameValue((ushort)currentInstr.data); 421 421 } 422 422 case OpCodes.Variable: { 423 423 if (row < 0 || row >= dataset.Rows) return double.NaN; 424 424 var variableTreeNode = (VariableTreeNode)currentInstr.dynamicNode; 425 return ((IList<double>)currentInstr. iArg0)[row] * variableTreeNode.Weight;425 return ((IList<double>)currentInstr.data)[row] * variableTreeNode.Weight; 426 426 } 427 427 case OpCodes.LagVariable: { … … 429 429 int actualRow = row + laggedVariableTreeNode.Lag; 430 430 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; 432 432 } 433 433 case OpCodes.Constant: { … … 441 441 if (row < 0 || row >= dataset.Rows) return double.NaN; 442 442 var variableConditionTreeNode = (VariableConditionTreeNode)currentInstr.dynamicNode; 443 double variableValue = ((IList<double>)currentInstr. iArg0)[row];443 double variableValue = ((IList<double>)currentInstr.data)[row]; 444 444 double x = variableValue - variableConditionTreeNode.Threshold; 445 445 double p = 1 / (1 + Math.Exp(-variableConditionTreeNode.Slope * x)); -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowData.cs
r9162 r9870 32 32 [Item("Sliding Window Position", "")] 33 33 public sealed class SlidingWindowData : Item { 34 35 34 [Storable] 36 35 private IntRange slidingWindowPosition; … … 39 38 } 40 39 41 [Storable]42 private IEnumerable<double> targetValues;43 40 public IEnumerable<double> TargetValues { 44 get { return targetValues; } 41 get { 42 return problemData.Dataset.GetDoubleValues(GetTargetVariableName(problemData), problemData.TrainingIndices); 43 } 45 44 } 46 45 … … 56 55 } 57 56 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 58 72 [StorableConstructor] 59 73 private SlidingWindowData(bool deserializing) : base(deserializing) { } … … 61 75 : base(original, cloner) { 62 76 slidingWindowPosition = cloner.Clone(original.slidingWindowPosition); 63 targetValues = new List<double>(original.targetValues);77 problemData = cloner.Clone(original.ProblemData); 64 78 } 65 79 public override IDeepCloneable Clone(Cloner cloner) { … … 67 81 } 68 82 69 public SlidingWindowData(IntRange slidingWindowPosition, I Enumerable<double> targetValues)83 public SlidingWindowData(IntRange slidingWindowPosition, IDataAnalysisProblemData problemData) 70 84 : base() { 71 85 this.slidingWindowPosition = slidingWindowPosition; 72 this. targetValues = targetValues.ToArray();86 this.problemData = (IDataAnalysisProblemData)problemData.Clone(); 73 87 } 74 88 … … 78 92 if (handler != null) EstimatedValuesChanged(this, EventArgs.Empty); 79 93 } 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 } 80 104 } 81 105 } -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowVisualizer.cs
r9707 r9870 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Linq; … … 78 77 SlidingWindowData slidingWindowData; 79 78 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); 89 80 results.Add(new Result(SlidingWindowDataResultName, slidingWindowData)); 90 81 } else slidingWindowData = (SlidingWindowData)results[SlidingWindowDataResultName].Value; -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r9708 r9870 196 196 197 197 SymbolicExpressionTreeGrammar = new TypeCoherentExpressionGrammar(); 198 SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTree Interpreter();198 SymbolicExpressionTreeInterpreter = new SymbolicDataAnalysisExpressionTreeLinearInterpreter(); 199 199 200 200 FitnessCalculationPartition.Start = ProblemData.TrainingPartition.Start;
Note: See TracChangeset
for help on using the changeset viewer.