Changeset 3916
- Timestamp:
- 06/11/10 14:14:01 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/SupportVectorRegression/SupportVectorRegressionSolution.cs
r3884 r3916 84 84 select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX).ToList(); 85 85 OnEstimatedValuesChanged(); 86 RecalculateResultValues(); 86 87 } 87 88 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs
r3884 r3916 57 57 select double.IsNaN(boundedX) ? UpperEstimationLimit : boundedX).ToList(); 58 58 OnEstimatedValuesChanged(); 59 RecalculateResultValues(); 59 60 } 60 61 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLab.Problems.DataAnalysis.Views-3.3.csproj
r3915 r3916 92 92 <DependentUpon>DataAnalysisSolutionView.cs</DependentUpon> 93 93 </Compile> 94 <Compile Include="ResultsView.cs"> 95 <SubType>UserControl</SubType> 96 </Compile> 97 <Compile Include="ResultsView.Designer.cs"> 98 <DependentUpon>ResultsView.cs</DependentUpon> 99 </Compile> 94 100 <Compile Include="SupportVectorRegressionSolutionView.cs"> 95 101 <SubType>UserControl</SubType> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/LineChartView.cs
r3764 r3916 43 43 public new DataAnalysisSolution Content { 44 44 get { return (DataAnalysisSolution)base.Content; } 45 set { 46 base.Content = value; 47 } 45 set { base.Content = value; } 48 46 } 49 47 … … 94 92 Content.ProblemDataChanged += new EventHandler(Content_ProblemDataChanged); 95 93 } 96 97 94 protected override void DeregisterContentEvents() { 98 95 base.DeregisterContentEvents(); … … 101 98 } 102 99 103 void Content_ProblemDataChanged(object sender, EventArgs e) {100 private void Content_ProblemDataChanged(object sender, EventArgs e) { 104 101 RedrawChart(); 105 102 } 106 103 107 void Content_EstimatedValuesChanged(object sender, EventArgs e) {104 private void Content_EstimatedValuesChanged(object sender, EventArgs e) { 108 105 UpdateEstimatedValuesLineChart(); 109 106 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/DataAnalysisSolution.cs
r3915 r3916 28 28 using System.Collections.Generic; 29 29 using System.Linq; 30 using HeuristicLab.Problems.DataAnalysis.Evaluators; 30 31 31 32 namespace HeuristicLab.Problems.DataAnalysis { … … 35 36 [Item("DataAnalysisSolution", "Represents a solution for a data analysis problem which can be visualized in the GUI.")] 36 37 [StorableClass] 37 public abstract class DataAnalysisSolution : NamedItem {38 public abstract class DataAnalysisSolution : NamedItem, IStringConvertibleMatrix { 38 39 protected DataAnalysisSolution() 39 40 : base() { } … … 144 145 public event EventHandler EstimatedValuesChanged; 145 146 protected virtual void OnEstimatedValuesChanged() { 147 RecalculateResultValues(); 146 148 var listeners = EstimatedValuesChanged; 147 149 if (listeners != null) … … 160 162 return clone; 161 163 } 164 165 #region IStringConvertibleMatrix implementation 166 private List<string> rowNames = new List<string>() { "MeanSquaredError", "CoefficientOfDetermination" }; 167 private List<string> columnNames = new List<string>() { "Training", "Test" }; 168 private double[,] resultValues = new double[2, 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 this.OnReset(); 193 } 194 195 public event EventHandler ColumnNamesChanged; 196 public event EventHandler RowNamesChanged; 197 public event EventHandler SortableViewChanged; 198 public event EventHandler<EventArgs<int, int>> ItemChanged; 199 public event EventHandler Reset; 200 protected virtual void OnReset() { 201 EventHandler handler = Reset; 202 if (handler != null) 203 handler(this, EventArgs.Empty); 204 } 205 #endregion 162 206 } 163 207 }
Note: See TracChangeset
for help on using the changeset viewer.