Changeset 4556
- Timestamp:
- 10/05/10 16:35:16 (14 years ago)
- Location:
- branches/DataAnalysis
- Files:
-
- 8 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Views/3.3/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Views-3.3.csproj
r4463 r4556 91 91 </PropertyGroup> 92 92 <ItemGroup> 93 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.2.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" /> 93 94 <Reference Include="System" /> 94 95 <Reference Include="System.Core"> … … 108 109 </ItemGroup> 109 110 <ItemGroup> 111 <Compile Include="PrognosisView.cs"> 112 <SubType>UserControl</SubType> 113 </Compile> 114 <Compile Include="PrognosisView.Designer.cs"> 115 <DependentUpon>PrognosisView.cs</DependentUpon> 116 </Compile> 110 117 <Compile Include="HeuristicLabProblemsDataAnalysisMultiVariateTimeSeriesPrognosisViewsPlugin.cs" /> 111 118 <Compile Include="InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs"> … … 114 121 <Compile Include="InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.Designer.cs"> 115 122 <DependentUpon>InteractiveSymbolicTimeSeriesPrognosisSolutionSimplifierView.cs</DependentUpon> 123 </Compile> 124 <Compile Include="TimeSeriesPrognosisLineChartView.cs"> 125 <SubType>UserControl</SubType> 126 </Compile> 127 <Compile Include="TimeSeriesPrognosisLineChartView.Designer.cs"> 128 <DependentUpon>TimeSeriesPrognosisLineChartView.cs</DependentUpon> 116 129 </Compile> 117 130 <Compile Include="ResultsView.cs"> … … 206 219 <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project> 207 220 <Name>HeuristicLab.Operators-3.3</Name> 221 </ProjectReference> 222 <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj"> 223 <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project> 224 <Name>HeuristicLab.Optimization.Views-3.3</Name> 208 225 </ProjectReference> 209 226 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Views/3.3/ResultsView.cs
r4457 r4556 155 155 List<string> targetVariables = Content.ProblemData.TargetVariables.CheckedItems.Select(x => x.Value.Value).ToList(); 156 156 157 int timestep = 0; 158 foreach (double[] x in Content.GetPrognosis(row)) { 159 int targetIndex = 0; 160 foreach (var targetVariable in targetVariables) { 161 double originalValue = Content.ProblemData.Dataset[targetVariable, row + timestep]; 162 double estimatedValue = x[targetIndex]; 163 if (IsValidValue(originalValue) && IsValidValue(estimatedValue)) { 164 foreach (IOnlineEvaluator evaluator in evaluators[targetVariable]) { 165 evaluator.Add(originalValue, estimatedValue); 157 if (string.IsNullOrEmpty(Content.ConditionalEvaluationVariable) || 158 Content.ProblemData.Dataset[Content.ConditionalEvaluationVariable, row] > 0) { 159 int timestep = 0; 160 foreach (double[] x in Content.GetPrognosis(row)) { 161 int targetIndex = 0; 162 if (row + timestep < Content.ProblemData.Dataset.Rows) { 163 foreach (var targetVariable in targetVariables) { 164 double originalValue = Content.ProblemData.Dataset[targetVariable, row + timestep]; 165 double estimatedValue = x[targetIndex]; 166 if (IsValidValue(originalValue) && IsValidValue(estimatedValue)) { 167 foreach (IOnlineEvaluator evaluator in evaluators[targetVariable]) { 168 evaluator.Add(originalValue, estimatedValue); 169 } 170 } 171 targetIndex++; 166 172 } 167 173 } 168 t argetIndex++;174 timestep++; 169 175 } 170 timestep++;171 176 } 172 177 } -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis/3.3/Symbolic/SymbolicTimeSeriesExpressionInterpreter.cs
r4475 r4556 136 136 137 137 foreach (var row in rows) { 138 ResetVariableValues(dataset, row);138 // ResetVariableValues(dataset, row); 139 139 for (int step = 0; step < predictionHorizon; step++) { 140 140 this.row = row + step; … … 169 169 170 170 foreach (var row in rows) { 171 ResetVariableValues(dataset, row);171 // ResetVariableValues(dataset, row); 172 172 for (int step = 0; step < predictionHorizon; step++) { 173 173 this.row = row + step; … … 190 190 #endregion 191 191 192 private void ResetVariableValues(Dataset dataset, int start) {193 foreach (var pair in estimatedTargetVariableValues) {194 int targetVariableIndex = pair.Key;195 double[] values = pair.Value;196 for (int i = 0; i < values.Length; i++) {197 values[i] = dataset[start + i, targetVariableIndex];198 }199 }200 }192 //private void ResetVariableValues(Dataset dataset, int start) { 193 // foreach (var pair in estimatedTargetVariableValues) { 194 // int targetVariableIndex = pair.Key; 195 // double[] values = pair.Value; 196 // for (int i = 0; i < values.Length; i++) { 197 // values[i] = dataset[start + i, targetVariableIndex]; 198 // } 199 // } 200 //} 201 201 202 202 private Instruction PostProcessInstruction(Instruction instr) { 203 if (instr.opCode == OpCodes.Variable || instr.opCode == OpCodes.LagVariable || 203 if (instr.opCode == OpCodes.Variable || instr.opCode == OpCodes.LagVariable || 204 204 instr.opCode == OpCodes.Integral || instr.opCode == OpCodes.MovingAverage || instr.opCode == OpCodes.Differential) { 205 205 var variableTreeNode = instr.dynamicNode as VariableTreeNode; 206 206 instr.iArg0 = (ushort)dataset.GetVariableIndex(variableTreeNode.VariableName); 207 } 207 } 208 208 return instr; 209 209 } … … 349 349 var lagVariableTreeNode = currentInstr.dynamicNode as LaggedVariableTreeNode; 350 350 int actualRow = row + lagVariableTreeNode.Lag; 351 if (actualRow < 0 || actualRow >= dataset.Rows )351 if (actualRow < 0 || actualRow >= dataset.Rows + currentPredictionHorizon) 352 352 return double.NaN; 353 353 return GetVariableValue(currentInstr.iArg0, lagVariableTreeNode.Lag) * lagVariableTreeNode.Weight; … … 355 355 case OpCodes.MovingAverage: { 356 356 var movingAvgTreeNode = currentInstr.dynamicNode as MovingAverageTreeNode; 357 if (row + movingAvgTreeNode.MinTimeOffset < 0 || row + movingAvgTreeNode.MaxTimeOffset >= dataset.Rows )357 if (row + movingAvgTreeNode.MinTimeOffset < 0 || row + movingAvgTreeNode.MaxTimeOffset >= dataset.Rows + currentPredictionHorizon) 358 358 return double.NaN; 359 359 double sum = 0.0; … … 365 365 case OpCodes.Differential: { 366 366 var diffTreeNode = currentInstr.dynamicNode as DerivativeVariableTreeNode; 367 if (row + diffTreeNode.Lag - 2 < 0 || row + diffTreeNode.Lag >= dataset.Rows )367 if (row + diffTreeNode.Lag - 2 < 0 || row + diffTreeNode.Lag >= dataset.Rows + currentPredictionHorizon) 368 368 return double.NaN; 369 369 double y_0 = GetVariableValue(currentInstr.iArg0, diffTreeNode.Lag); 370 370 double y_1 = GetVariableValue(currentInstr.iArg0, diffTreeNode.Lag - 1); 371 371 double y_2 = GetVariableValue(currentInstr.iArg0, diffTreeNode.Lag - 2); 372 return diffTreeNode.Weight * ( 3 *y_0 - 4 * y_1 + 3 * y_2) / 2;372 return diffTreeNode.Weight * (y_0 - 4 * y_1 + 3 * y_2) / 2; 373 373 } 374 374 case OpCodes.Integral: { 375 375 var integralVarTreeNode = currentInstr.dynamicNode as IntegratedVariableTreeNode; 376 if (row + integralVarTreeNode.MinTimeOffset < 0 || row + integralVarTreeNode.MaxTimeOffset >= dataset.Rows )376 if (row + integralVarTreeNode.MinTimeOffset < 0 || row + integralVarTreeNode.MaxTimeOffset >= dataset.Rows + currentPredictionHorizon) 377 377 return double.NaN; 378 378 double sum = 0; … … 391 391 392 392 private double GetVariableValue(int variableIndex, int timeoffset) { 393 if (estimatedTargetVariableValues.ContainsKey(variableIndex) && 394 currentPredictionHorizon + timeoffset >= 0) { 395 return estimatedTargetVariableValues[variableIndex][currentPredictionHorizon + timeoffset]; 393 if (currentPredictionHorizon + timeoffset >= 0) { 394 double[] values; 395 estimatedTargetVariableValues.TryGetValue(variableIndex, out values); 396 if (values != null) { 397 return values[currentPredictionHorizon + timeoffset]; 398 } 399 } 400 if (row + timeoffset < 0 || row + timeoffset >= dataset.Rows) { 401 return double.NaN; 396 402 } else { 397 403 return dataset[row + timeoffset, variableIndex]; -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis/3.3/Symbolic/SymbolicTimeSeriesPrognosisSolution.cs
r4475 r4556 117 117 118 118 public IEnumerable<double[]> GetPrognosis(int t) { 119 return model.GetEstimatedValues(problemData, t, t + 1 );119 return model.GetEstimatedValues(problemData, t, t + 1, horizon); 120 120 } 121 121 -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.Views/3.3/HeuristicLab.Problems.DataAnalysis.MultiVariate.Views-3.3.csproj
r4463 r4556 91 91 </PropertyGroup> 92 92 <ItemGroup> 93 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.2.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" /> 94 <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" /> 93 95 <Reference Include="System" /> 94 96 <Reference Include="System.Core"> … … 170 172 <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project> 171 173 <Name>HeuristicLab.MainForm-3.3</Name> 174 </ProjectReference> 175 <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj"> 176 <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project> 177 <Name>HeuristicLab.Optimization.Views-3.3</Name> 172 178 </ProjectReference> 173 179 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.Views/3.3/LineChartView.cs
r4401 r4556 55 55 private void RedrawChart() { 56 56 this.chart.Series.Clear(); 57 IEnumerable<double[]> values = Content.EstimatedValues;58 57 if (Content != null) { 58 IEnumerable<double[]> values = Content.EstimatedValues; 59 59 List<string> targetVariables = Content.ProblemData.TargetVariables.CheckedItems.Select(x => x.Value.Value).ToList(); 60 60 for (int col = 0; col < targetVariables.Count; col++) { -
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Views/3.3/Symbolic/SymbolicExpressionTreeLatexFormatter.cs
r4327 r4556 79 79 } else if (node.Symbol is Variable) { 80 80 var varNode = node as VariableTreeNode; 81 strBuilder.Append(" " + varNode. VariableName+ " ");81 strBuilder.Append(" " + varNode.ToString()+ " "); 82 82 } else if (node.Symbol is ProgramRootSymbol) { 83 83 } else if (node.Symbol is Defun) {
Note: See TracChangeset
for help on using the changeset viewer.