Changeset 5010 for branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Views/3.3/PrognosisView.cs
- Timestamp:
- 12/02/10 15:25:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Views/3.3/PrognosisView.cs
r4556 r5010 76 76 DoubleMatrix matrix = null; 77 77 if (Content != null) { 78 IEnumerable<string> targetVariables = Content.ProblemData.TargetVariables.CheckedItems.Select(x => x.Value.Value); 79 List<double[]> prognosis = Content.GetPrognosis(currentTimePoint).ToList(); 80 double[,] values = new double[prognosis.Count, targetVariables.Count() * 2]; 81 for (int row = 0; row < prognosis.Count; row++) { 82 int col = 0; 83 int t = currentTimePoint + row; 84 foreach (string targetVariable in targetVariables) { 85 values[row, col++] = t<Content.ProblemData.Dataset.Rows ? Content.ProblemData.Dataset[targetVariable, t] : double.NaN; 86 values[row, col++] = prognosis[row][(col - 1) / 2]; 87 } 88 } 89 matrix = new DoubleMatrix(values); 90 string[] partitions = new string[] { "(original)", "(estimated)" }; 91 matrix.ColumnNames = from targetVariable in targetVariables 92 from partition in partitions 93 select targetVariable + " " + partition; 94 ; 78 matrix = CalculateMatrix(); 95 79 } 96 80 valuesView.Content = matrix; 81 } 82 83 public DoubleMatrix CalculateMatrix() { 84 DoubleMatrix matrix = null; 85 IEnumerable<string> targetVariables = Content.ProblemData.TargetVariables.CheckedItems.Select(x => x.Value.Value); 86 List<double[]> prognosis = Content.GetPrognosis(currentTimePoint).ToList(); 87 double[,] values = new double[prognosis.Count, targetVariables.Count() * 2]; 88 for (int row = 0; row < prognosis.Count; row++) { 89 int col = 0; 90 int t = currentTimePoint + row; 91 foreach (string targetVariable in targetVariables) { 92 values[row, col++] = t < Content.ProblemData.Dataset.Rows ? Content.ProblemData.Dataset[targetVariable, t] : double.NaN; 93 values[row, col++] = prognosis[row][(col - 1) / 2]; 94 } 95 } 96 matrix = new DoubleMatrix(values); 97 string[] partitions = new string[] { "(original)", "(estimated)" }; 98 matrix.ColumnNames = from targetVariable in targetVariables 99 from partition in partitions 100 select targetVariable + " " + partition; 101 ; 102 return matrix; 97 103 } 98 104
Note: See TracChangeset
for help on using the changeset viewer.