- Timestamp:
- 06/30/10 10:58:01 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/SupportVectorRegressionSolution.cs
r3933 r3979 84 84 select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX).ToList(); 85 85 OnEstimatedValuesChanged(); 86 RecalculateResultValues();87 86 } 88 87 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs
r3916 r3979 57 57 select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX).ToList(); 58 58 OnEstimatedValuesChanged(); 59 RecalculateResultValues();60 59 } 61 60 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/ResultsView.Designer.cs
r3916 r3979 44 44 /// </summary> 45 45 private void InitializeComponent() { 46 components = new System.ComponentModel.Container(); 46 this.matrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 47 this.SuspendLayout(); 48 // 49 // matrixView 50 // 51 this.matrixView.Caption = "StringConvertibleMatrix View"; 52 this.matrixView.Content = null; 53 this.matrixView.Dock = System.Windows.Forms.DockStyle.Fill; 54 this.matrixView.Location = new System.Drawing.Point(0, 0); 55 this.matrixView.Name = "matrixView"; 56 this.matrixView.ReadOnly = true; 57 this.matrixView.Size = new System.Drawing.Size(494, 317); 58 this.matrixView.TabIndex = 0; 59 // 60 // ResultsView 61 // 62 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 47 63 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 64 this.Controls.Add(this.matrixView); 65 this.Name = "ResultsView"; 66 this.Size = new System.Drawing.Size(494, 317); 67 this.ResumeLayout(false); 68 48 69 } 49 70 50 71 #endregion 72 73 private HeuristicLab.Data.Views.StringConvertibleMatrixView matrixView; 51 74 } 52 75 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/ResultsView.cs
r3916 r3979 30 30 using HeuristicLab.MainForm.WindowsForms; 31 31 using HeuristicLab.Data.Views; 32 using HeuristicLab.Data; 33 using HeuristicLab.Problems.DataAnalysis.Evaluators; 32 34 33 35 namespace HeuristicLab.Problems.DataAnalysis.Views { 34 36 [Content(typeof(DataAnalysisSolution),false)] 35 37 [View("Results View")] 36 public partial class ResultsView : StringConvertibleMatrixView { 38 public partial class ResultsView : AsynchronousContentView { 39 private List<string> rowNames = new List<string>() { "MeanSquaredError", "CoefficientOfDetermination", "MeanAbsolutePercentageError" }; 40 private List<string> columnNames = new List<string>() { "Training", "Test" }; 41 37 42 public ResultsView() { 38 43 InitializeComponent(); … … 43 48 set { base.Content = value; } 44 49 } 50 51 protected override void RegisterContentEvents() { 52 base.RegisterContentEvents(); 53 Content.ModelChanged += new EventHandler(Content_ModelChanged); 54 Content.ProblemDataChanged += new EventHandler(Content_ProblemDataChanged); 55 Content.EstimatedValuesChanged += new EventHandler(Content_EstimatedValuesChanged); 56 } 57 protected override void DeregisterContentEvents() { 58 base.DeregisterContentEvents(); 59 Content.ModelChanged -= new EventHandler(Content_ModelChanged); 60 Content.ProblemDataChanged -= new EventHandler(Content_ProblemDataChanged); 61 Content.EstimatedValuesChanged -= new EventHandler(Content_EstimatedValuesChanged); 62 } 63 64 private void Content_ModelChanged(object sender, EventArgs e) { 65 UpdateView(); 66 } 67 private void Content_ProblemDataChanged(object sender, EventArgs e) { 68 UpdateView(); 69 } 70 private void Content_EstimatedValuesChanged(object sender, EventArgs e) { 71 UpdateView(); 72 } 73 74 protected override void OnContentChanged() { 75 base.OnContentChanged(); 76 UpdateView(); 77 } 78 private void UpdateView() { 79 if (Content != null) { 80 DoubleMatrix matrix = new DoubleMatrix(rowNames.Count, columnNames.Count); 81 matrix.RowNames = rowNames; 82 matrix.ColumnNames = columnNames; 83 matrix.SortableView = false; 84 85 IEnumerable<double> originalTrainingValues = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable.Value, Content.ProblemData.TrainingSamplesStart.Value, Content.ProblemData.TrainingSamplesEnd.Value); 86 IEnumerable<double> originalTestValues = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable.Value, Content.ProblemData.TestSamplesStart.Value, Content.ProblemData.TestSamplesEnd.Value); 87 matrix[0, 0] = SimpleMSEEvaluator.Calculate(originalTrainingValues, Content.EstimatedTrainingValues); 88 matrix[0, 1] = SimpleMSEEvaluator.Calculate(originalTestValues, Content.EstimatedTestValues); 89 matrix[1, 0] = SimpleRSquaredEvaluator.Calculate(originalTrainingValues, Content.EstimatedTrainingValues); 90 matrix[1, 1] = SimpleRSquaredEvaluator.Calculate(originalTestValues, Content.EstimatedTestValues); 91 matrix[2, 0] = SimpleMeanAbsolutePercentageErrorEvaluator.Calculate(originalTrainingValues, Content.EstimatedTrainingValues); 92 matrix[2, 1] = SimpleMeanAbsolutePercentageErrorEvaluator.Calculate(originalTestValues, Content.EstimatedTestValues); 93 94 matrixView.Content = matrix; 95 } else 96 matrixView.Content = null; 97 } 45 98 } 46 99 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisSolution.cs
r3933 r3979 36 36 [Item("DataAnalysisSolution", "Represents a solution for a data analysis problem which can be visualized in the GUI.")] 37 37 [StorableClass] 38 public abstract class DataAnalysisSolution : NamedItem , IStringConvertibleMatrix{38 public abstract class DataAnalysisSolution : NamedItem { 39 39 protected DataAnalysisSolution() 40 40 : base() { } … … 162 162 return clone; 163 163 } 164 165 #region IStringConvertibleMatrix implementation166 private List<string> rowNames = new List<string>() { "MeanSquaredError", "CoefficientOfDetermination", "MeanAbsolutePercentageError" };167 private List<string> columnNames = new List<string>() { "Training", "Test" };168 private double[,] resultValues = new double[3, 2];169 int IStringConvertibleMatrix.Rows { get { return rowNames.Count; } set { } }170 int IStringConvertibleMatrix.Columns { get { return columnNames.Count; } set { } }171 IEnumerable<string> IStringConvertibleMatrix.ColumnNames { get { return columnNames; } set { } }172 IEnumerable<string> IStringConvertibleMatrix.RowNames { get { return rowNames; } set { } }173 bool IStringConvertibleMatrix.SortableView { get { return false; } set { } }174 bool IStringConvertibleMatrix.ReadOnly { get { return true; } }175 176 string IStringConvertibleMatrix.GetValue(int rowIndex, int columnIndex) {177 return resultValues[rowIndex, columnIndex].ToString();178 }179 bool IStringConvertibleMatrix.Validate(string value, out string errorMessage) {180 errorMessage = "This matrix is readonly.";181 return false;182 }183 bool IStringConvertibleMatrix.SetValue(string value, int rowIndex, int columnIndex) { return false; }184 185 protected void RecalculateResultValues() {186 IEnumerable<double> originalTrainingValues = problemData.Dataset.GetVariableValues(problemData.TargetVariable.Value, problemData.TrainingSamplesStart.Value, problemData.TrainingSamplesEnd.Value);187 IEnumerable<double> originalTestValues = problemData.Dataset.GetVariableValues(problemData.TargetVariable.Value, problemData.TestSamplesStart.Value, problemData.TestSamplesEnd.Value);188 resultValues[0, 0] = SimpleMSEEvaluator.Calculate(originalTrainingValues, EstimatedTrainingValues);189 resultValues[0, 1] = SimpleMSEEvaluator.Calculate(originalTestValues, EstimatedTestValues);190 resultValues[1, 0] = SimpleRSquaredEvaluator.Calculate(originalTrainingValues, EstimatedTrainingValues);191 resultValues[1, 1] = SimpleRSquaredEvaluator.Calculate(originalTestValues, EstimatedTestValues);192 resultValues[2, 0] = SimpleMeanAbsolutePercentageErrorEvaluator.Calculate(originalTrainingValues, EstimatedTrainingValues);193 resultValues[2, 1] = SimpleMeanAbsolutePercentageErrorEvaluator.Calculate(originalTestValues, EstimatedTestValues);194 195 this.OnReset();196 }197 198 public event EventHandler ColumnNamesChanged;199 public event EventHandler RowNamesChanged;200 public event EventHandler SortableViewChanged;201 public event EventHandler<EventArgs<int, int>> ItemChanged;202 public event EventHandler Reset;203 protected virtual void OnReset() {204 EventHandler handler = Reset;205 if (handler != null)206 handler(this, EventArgs.Empty);207 }208 #endregion209 164 } 210 165 }
Note: See TracChangeset
for help on using the changeset viewer.