- Timestamp:
- 09/14/11 13:59:25 (13 years ago)
- Location:
- branches/PersistenceSpeedUp
- Files:
-
- 20 deleted
- 17 edited
- 30 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp
- Property svn:ignore
-
old new 12 12 *.psess 13 13 *.vsp 14 *.docstates
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.3/HeuristicLabProblemsDataAnalysisViewsPlugin.cs.frame
r6099 r6760 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis.Views { 28 [Plugin("HeuristicLab.Problems.DataAnalysis.Views", "3.3. 4.$WCREV$")]28 [Plugin("HeuristicLab.Problems.DataAnalysis.Views", "3.3.5.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.DataAnalysis.Views-3.3.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.ALGLIB","3.1.0.0")] -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.3/Properties/AssemblyInfo.frame
r6099 r6760 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.3.0.0")] 55 [assembly: AssemblyFileVersion("3.3. 4.$WCREV$")]55 [assembly: AssemblyFileVersion("3.3.5.$WCREV$")] -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionConfusionMatrixView.cs
r5975 r6760 24 24 using System.Linq; 25 25 using System.Windows.Forms; 26 using HeuristicLab.Core.Views;27 26 using HeuristicLab.MainForm; 28 27 using HeuristicLab.MainForm.WindowsForms; … … 31 30 [View("Confusion Matrix")] 32 31 [Content(typeof(IClassificationSolution))] 33 public partial class ClassificationSolutionConfusionMatrixView : ItemView, IClassificationSolutionEvaluationView {32 public partial class ClassificationSolutionConfusionMatrixView : DataAnalysisSolutionEvaluationView { 34 33 private const string TrainingSamples = "Training"; 35 34 private const string TestSamples = "Test"; … … 78 77 dataGridView.ColumnCount = 1; 79 78 } else { 80 dataGridView.ColumnCount = Content.ProblemData.Classes ;81 dataGridView.RowCount = Content.ProblemData.Classes ;79 dataGridView.ColumnCount = Content.ProblemData.Classes + 1; 80 dataGridView.RowCount = Content.ProblemData.Classes + 1; 82 81 83 82 int i = 0; … … 87 86 i++; 88 87 } 88 dataGridView.Columns[i].HeaderText = "Actual not classified"; 89 dataGridView.Rows[i].HeaderCell.Value = "Predicted not classified"; 90 89 91 dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader); 90 92 dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders); … … 100 102 if (Content == null) return; 101 103 102 double[,] confusionMatrix = new double[Content.ProblemData.Classes , Content.ProblemData.Classes];104 double[,] confusionMatrix = new double[Content.ProblemData.Classes + 1, Content.ProblemData.Classes + 1]; 103 105 IEnumerable<int> rows; 104 106 107 double[] predictedValues; 105 108 if (cmbSamples.SelectedItem.ToString() == TrainingSamples) { 106 109 rows = Content.ProblemData.TrainingIndizes; 110 predictedValues = Content.EstimatedTrainingClassValues.ToArray(); 107 111 } else if (cmbSamples.SelectedItem.ToString() == TestSamples) { 108 112 rows = Content.ProblemData.TestIndizes; 113 predictedValues = Content.EstimatedTestClassValues.ToArray(); 109 114 } else throw new InvalidOperationException(); 115 116 double[] targetValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable, rows).ToArray(); 110 117 111 118 Dictionary<double, int> classValueIndexMapping = new Dictionary<double, int>(); … … 116 123 } 117 124 118 double[] targetValues = Content.ProblemData.Dataset.GetEnumeratedVariableValues(Content.ProblemData.TargetVariable, rows).ToArray();119 double[] predictedValues = Content.GetEstimatedClassValues(rows).ToArray();120 121 125 for (int i = 0; i < targetValues.Length; i++) { 122 126 double targetValue = targetValues[i]; 123 127 double predictedValue = predictedValues[i]; 124 int targetIndex = classValueIndexMapping[targetValue]; 125 int predictedIndex = classValueIndexMapping[predictedValue]; 128 int targetIndex; 129 int predictedIndex; 130 if (!classValueIndexMapping.TryGetValue(targetValue, out targetIndex)) { 131 targetIndex = Content.ProblemData.Classes; 132 } 133 if (!classValueIndexMapping.TryGetValue(predictedValue, out predictedIndex)) { 134 predictedIndex = Content.ProblemData.Classes; 135 } 126 136 127 137 confusionMatrix[predictedIndex, targetIndex] += 1; -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionEstimatedClassValuesView.cs
r5975 r6760 22 22 using System.Linq; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Core.Views;25 24 using HeuristicLab.Data; 26 25 using HeuristicLab.Data.Views; … … 31 30 [View("Estimated Class Values")] 32 31 [Content(typeof(IClassificationSolution))] 33 public partial class ClassificationSolutionEstimatedClassValuesView : ItemView, IClassificationSolutionEvaluationView { 34 private const string TARGETVARIABLE_SERIES_NAME = "TargetVariable"; 35 private const string ESTIMATEDVALUES_SERIES_NAME = "EstimatedClassValues"; 32 public partial class ClassificationSolutionEstimatedClassValuesView : DataAnalysisSolutionEvaluationView { 33 private const string TARGETVARIABLE_SERIES_NAME = "Target Variable"; 34 private const string ESTIMATEDVALUES_SERIES_NAME = "Estimated Class Values (all)"; 35 private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Class Values (training)"; 36 private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Class Values (test)"; 36 37 37 38 public new IClassificationSolution Content { 38 39 get { return (IClassificationSolution)base.Content; } 39 set { 40 base.Content = value; 41 } 40 set { base.Content = value; } 42 41 } 43 42 44 pr ivateStringConvertibleMatrixView matrixView;43 protected StringConvertibleMatrixView matrixView; 45 44 46 45 public ClassificationSolutionEstimatedClassValuesView() … … 80 79 } 81 80 82 pr ivatevoid UpdateEstimatedValues() {81 protected virtual void UpdateEstimatedValues() { 83 82 if (InvokeRequired) Invoke((Action)UpdateEstimatedValues); 84 83 else { 85 DoubleMatrix matrix = null;84 StringMatrix matrix = null; 86 85 if (Content != null) { 87 double[,] values = new double[Content.ProblemData.Dataset.Rows, 2];86 string[,] values = new string[Content.ProblemData.Dataset.Rows, 5]; 88 87 89 double[] target = Content.ProblemData.Dataset.Get VariableValues(Content.ProblemData.TargetVariable);88 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 90 89 double[] estimated = Content.EstimatedClassValues.ToArray(); 91 90 for (int row = 0; row < target.Length; row++) { 92 values[row, 0] = target[row]; 93 values[row, 1] = estimated[row]; 91 values[row, 0] = row.ToString(); 92 values[row, 1] = target[row].ToString(); 93 values[row, 2] = estimated[row].ToString(); 94 94 } 95 95 96 matrix = new DoubleMatrix(values); 97 matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME }; 96 var estimatedTraining = Content.EstimatedTrainingClassValues.GetEnumerator(); 97 estimatedTraining.MoveNext(); 98 foreach (var trainingRow in Content.ProblemData.TrainingIndizes) { 99 values[trainingRow, 3] = estimatedTraining.Current.ToString(); 100 estimatedTraining.MoveNext(); 101 } 102 var estimatedTest = Content.EstimatedTestClassValues.GetEnumerator(); 103 estimatedTest.MoveNext(); 104 foreach (var testRow in Content.ProblemData.TestIndizes) { 105 values[testRow, 4] = estimatedTest.Current.ToString(); 106 estimatedTest.MoveNext(); 107 } 108 109 matrix = new StringMatrix(values); 110 matrix.ColumnNames = new string[] { "Id", TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME }; 111 matrix.SortableView = true; 98 112 } 99 113 matrixView.Content = matrix; -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationRocCurvesView.cs
r5975 r6760 28 28 using System.Windows.Forms.DataVisualization.Charting; 29 29 using HeuristicLab.Common; 30 using HeuristicLab.Core.Views;31 30 using HeuristicLab.MainForm; 32 31 using HeuristicLab.MainForm.WindowsForms; … … 34 33 [View("ROC Curves")] 35 34 [Content(typeof(IDiscriminantFunctionClassificationSolution))] 36 public partial class DiscriminantFunctionClassificationRocCurvesView : ItemView, IDiscriminantFunctionClassificationSolutionEvaluationView {35 public partial class DiscriminantFunctionClassificationRocCurvesView : DataAnalysisSolutionEvaluationView { 37 36 private const string xAxisTitle = "False Positive Rate"; 38 37 private const string yAxisTitle = "True Positive Rate"; … … 108 107 109 108 double[] estimatedValues = Content.GetEstimatedValues(rows).ToArray(); 110 double[] targetClassValues = Content.ProblemData.Dataset.Get EnumeratedVariableValues(Content.ProblemData.TargetVariable, rows).ToArray();109 double[] targetClassValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable, rows).ToArray(); 111 110 double minThreshold = estimatedValues.Min(); 112 111 double maxThreshold = estimatedValues.Max(); -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionEstimatedClassValuesView.cs
r5975 r6760 22 22 using System.Linq; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Core.Views;25 24 using HeuristicLab.Data; 26 using HeuristicLab.Data.Views;27 25 using HeuristicLab.MainForm; 28 26 using HeuristicLab.MainForm.WindowsForms; … … 31 29 [View("Estimated Class Values")] 32 30 [Content(typeof(IDiscriminantFunctionClassificationSolution))] 33 public partial class DiscriminantFunctionClassificationSolutionEstimatedClassValuesView : ItemView, IDiscriminantFunctionClassificationSolutionEvaluationView {31 public partial class DiscriminantFunctionClassificationSolutionEstimatedClassValuesView : ClassificationSolutionEstimatedClassValuesView { 34 32 private const string TargetClassValuesSeriesname = "TargetVariable"; 35 33 private const string EstimatedClassValuesSeriesName = "EstimatedClassValues"; … … 38 36 public new IDiscriminantFunctionClassificationSolution Content { 39 37 get { return (IDiscriminantFunctionClassificationSolution)base.Content; } 40 set { 41 base.Content = value; 42 } 38 set { base.Content = value; } 43 39 } 44 45 private StringConvertibleMatrixView matrixView;46 40 47 41 public DiscriminantFunctionClassificationSolutionEstimatedClassValuesView() 48 42 : base() { 49 43 InitializeComponent(); 50 matrixView = new StringConvertibleMatrixView();51 matrixView.ShowRowsAndColumnsTextBox = false;52 matrixView.ShowStatisticalInformation = false;53 matrixView.Dock = DockStyle.Fill;54 this.Controls.Add(matrixView);55 44 } 56 45 57 #region events 58 protected override void RegisterContentEvents() { 59 base.RegisterContentEvents(); 60 Content.ModelChanged += new EventHandler(Content_ModelChanged); 61 Content.ProblemDataChanged += new EventHandler(Content_ProblemDataChanged); 62 } 63 64 protected override void DeregisterContentEvents() { 65 base.DeregisterContentEvents(); 66 Content.ModelChanged -= new EventHandler(Content_ModelChanged); 67 Content.ProblemDataChanged -= new EventHandler(Content_ProblemDataChanged); 68 } 69 70 private void Content_ProblemDataChanged(object sender, EventArgs e) { 71 OnContentChanged(); 72 } 73 74 private void Content_ModelChanged(object sender, EventArgs e) { 75 OnContentChanged(); 76 } 77 78 protected override void OnContentChanged() { 79 base.OnContentChanged(); 80 UpdateEstimatedValues(); 81 } 82 83 private void UpdateEstimatedValues() { 46 protected override void UpdateEstimatedValues() { 84 47 if (InvokeRequired) Invoke((Action)UpdateEstimatedValues); 85 48 else { 86 DoubleMatrix matrix = null;49 StringMatrix matrix = null; 87 50 if (Content != null) { 88 double[,] values = new double[Content.ProblemData.Dataset.Rows, 3];51 string[,] values = new string[Content.ProblemData.Dataset.Rows, 4]; 89 52 90 double[] target = Content.ProblemData.Dataset.Get VariableValues(Content.ProblemData.TargetVariable);53 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 91 54 double[] estimatedClassValues = Content.EstimatedClassValues.ToArray(); 92 55 double[] estimatedValues = Content.EstimatedValues.ToArray(); 93 56 for (int row = 0; row < target.Length; row++) { 94 values[row, 0] = target[row]; 95 values[row, 1] = estimatedClassValues[row]; 96 values[row, 2] = estimatedValues[row]; 57 values[row, 0] = row.ToString(); 58 values[row, 1] = target[row].ToString(); 59 values[row, 2] = estimatedClassValues[row].ToString(); 60 values[row, 3] = estimatedValues[row].ToString(); 97 61 } 98 62 99 matrix = new DoubleMatrix(values); 100 matrix.ColumnNames = new string[] { TargetClassValuesSeriesname, EstimatedClassValuesSeriesName, EstimatedValuesSeriesName }; 63 matrix = new StringMatrix(values); 64 matrix.ColumnNames = new string[] { "Id", TargetClassValuesSeriesname, EstimatedClassValuesSeriesName, EstimatedValuesSeriesName }; 65 matrix.SortableView = true; 101 66 } 102 67 matrixView.Content = matrix; 103 68 } 104 69 } 105 #endregion106 70 } 107 71 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/DiscriminantFunctionClassificationSolutionThresholdView.cs
r5975 r6760 27 27 using System.Windows.Forms.DataVisualization.Charting; 28 28 using HeuristicLab.Common; 29 using HeuristicLab.Core.Views;30 29 using HeuristicLab.MainForm; 31 30 using HeuristicLab.MainForm.WindowsForms; … … 33 32 namespace HeuristicLab.Problems.DataAnalysis.Views { 34 33 [View("Classification Threshold")] 35 [Content(typeof(IDiscriminantFunctionClassificationSolution), true)]36 public sealed partial class DiscriminantFunctionClassificationSolutionThresholdView : ItemView, IDiscriminantFunctionClassificationSolutionEvaluationView {34 [Content(typeof(IDiscriminantFunctionClassificationSolution), false)] 35 public sealed partial class DiscriminantFunctionClassificationSolutionThresholdView : DataAnalysisSolutionEvaluationView { 37 36 private const double TrainingAxisValue = 0.0; 38 37 private const double TestAxisValue = 10.0; … … 136 135 private void FillSeriesWithDataPoints(Series series) { 137 136 List<double> estimatedValues = Content.EstimatedValues.ToList(); 137 var targetValues = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToList(); 138 138 139 foreach (int row in Content.ProblemData.TrainingIndizes) { 139 140 double estimatedValue = estimatedValues[row]; 140 double targetValue = Content.ProblemData.Dataset[Content.ProblemData.TargetVariable,row];141 double targetValue = targetValues[row]; 141 142 if (targetValue.IsAlmost((double)series.Tag)) { 142 143 double jitterValue = random.NextDouble() * 2.0 - 1.0; … … 151 152 foreach (int row in Content.ProblemData.TestIndizes) { 152 153 double estimatedValue = estimatedValues[row]; 153 double targetValue = Content.ProblemData.Dataset[Content.ProblemData.TargetVariable,row];154 if (targetValue == (double)series.Tag) {154 double targetValue = targetValues[row]; 155 if (targetValue.IsAlmost((double)series.Tag)) { 155 156 double jitterValue = random.NextDouble() * 2.0 - 1.0; 156 157 DataPoint point = new DataPoint(); -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Clustering/ClusteringSolutionEstimatedClusterView.cs
r6003 r6760 22 22 using System.Linq; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Core.Views;25 24 using HeuristicLab.Data; 26 25 using HeuristicLab.Data.Views; … … 31 30 [View("Estimated Clusters")] 32 31 [Content(typeof(IClusteringSolution))] 33 public partial class ClusteringSolutionEstimatedClusterView : ItemView, IClusteringSolutionEvaluationView {32 public partial class ClusteringSolutionEstimatedClusterView : DataAnalysisSolutionEvaluationView { 34 33 private const string CLUSTER_NAMES = "Cluster"; 35 34 … … 86 85 int[] clusters = Content.Model.GetClusterValues(Content.ProblemData.Dataset, Enumerable.Range(0, Content.ProblemData.Dataset.Rows)).ToArray(); 87 86 var dataset = Content.ProblemData.Dataset; 88 int columns = Content.ProblemData.AllowedInputVariables.Count() + 1; 89 var columnsIndixes = Content.ProblemData.AllowedInputVariables.Select(x => dataset.GetVariableIndex(x)).ToList(); 87 int columns = Content.ProblemData.AllowedInputVariables.Count() + 1; 90 88 91 89 double[,] values = new double[dataset.Rows, columns]; … … 94 92 95 93 int column = 1; 96 foreach ( int columnIndex in columnsIndixes) {97 values[row, column] = dataset [row, columnIndex];94 foreach (var columnName in Content.ProblemData.AllowedInputVariables) { 95 values[row, column] = dataset.GetDoubleValue(columnName, row); 98 96 column++; 99 97 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r6184 r6760 110 110 </ItemGroup> 111 111 <ItemGroup> 112 <Compile Include="ClassificationSolutionView.cs"> 113 <SubType>UserControl</SubType> 114 </Compile> 115 <Compile Include="ClassificationSolutionView.Designer.cs"> 112 <Compile Include="Classification\ClassificationEnsembleSolutionEstimatedClassValuesView.cs"> 113 <SubType>UserControl</SubType> 114 </Compile> 115 <Compile Include="Classification\ClassificationEnsembleSolutionEstimatedClassValuesView.Designer.cs"> 116 <DependentUpon>ClassificationEnsembleSolutionEstimatedClassValuesView.cs</DependentUpon> 117 </Compile> 118 <Compile Include="Classification\ClassificationEnsembleSolutionModelView.cs"> 119 <SubType>UserControl</SubType> 120 </Compile> 121 <Compile Include="Classification\ClassificationEnsembleSolutionModelView.Designer.cs"> 122 <DependentUpon>ClassificationEnsembleSolutionModelView.cs</DependentUpon> 123 </Compile> 124 <Compile Include="DataAnalysisSolutionEvaluationView.cs"> 125 <SubType>UserControl</SubType> 126 </Compile> 127 <Compile Include="DataAnalysisSolutionEvaluationView.Designer.cs"> 128 <DependentUpon>DataAnalysisSolutionEvaluationView.cs</DependentUpon> 129 </Compile> 130 <Compile Include="Regression\RegressionSolutionErrorCharacteristicsCurveView.cs"> 131 <SubType>UserControl</SubType> 132 </Compile> 133 <Compile Include="Regression\RegressionSolutionErrorCharacteristicsCurveView.Designer.cs"> 134 <DependentUpon>RegressionSolutionErrorCharacteristicsCurveView.cs</DependentUpon> 135 </Compile> 136 <Compile Include="Regression\RegressionEnsembleSolutionModelView.cs"> 137 <SubType>UserControl</SubType> 138 </Compile> 139 <Compile Include="Regression\RegressionEnsembleSolutionModelView.Designer.cs"> 140 <DependentUpon>RegressionEnsembleSolutionModelView.cs</DependentUpon> 141 </Compile> 142 <Compile Include="Solution Views\ClassificationSolutionView.cs"> 143 <SubType>UserControl</SubType> 144 </Compile> 145 <Compile Include="Solution Views\ClassificationSolutionView.Designer.cs"> 116 146 <DependentUpon>ClassificationSolutionView.cs</DependentUpon> 117 147 </Compile> … … 152 182 <DependentUpon>ClusteringSolutionEstimatedClusterView.cs</DependentUpon> 153 183 </Compile> 154 <Compile Include=" ClusteringSolutionView.cs">155 <SubType>UserControl</SubType> 156 </Compile> 157 <Compile Include=" ClusteringSolutionView.Designer.cs">184 <Compile Include="Solution Views\ClusteringSolutionView.cs"> 185 <SubType>UserControl</SubType> 186 </Compile> 187 <Compile Include="Solution Views\ClusteringSolutionView.Designer.cs"> 158 188 <DependentUpon>ClusteringSolutionView.cs</DependentUpon> 159 189 </Compile> 160 <Compile Include="Interfaces\IRegressionEnsembleSolutionEvaluationView.cs" /> 161 <Compile Include="RegressionEnsembleSolutionView.cs"> 162 <SubType>UserControl</SubType> 163 </Compile> 164 <Compile Include="RegressionEnsembleSolutionView.Designer.cs"> 165 <DependentUpon>RegressionEnsembleSolutionView.cs</DependentUpon> 166 </Compile> 167 <Compile Include="DiscriminantFunctionClassificationSolutionView.cs"> 168 <SubType>UserControl</SubType> 169 </Compile> 170 <Compile Include="DiscriminantFunctionClassificationSolutionView.Designer.cs"> 190 <Compile Include="Solution Views\ClassificationEnsembleSolutionView.cs"> 191 <SubType>UserControl</SubType> 192 </Compile> 193 <Compile Include="Solution Views\ClassificationEnsembleSolutionView.Designer.cs"> 194 <DependentUpon>ClassificationEnsembleSolutionView.cs</DependentUpon> 195 </Compile> 196 <Compile Include="Solution Views\DiscriminantFunctionClassificationSolutionView.cs"> 197 <SubType>UserControl</SubType> 198 </Compile> 199 <Compile Include="Solution Views\DiscriminantFunctionClassificationSolutionView.Designer.cs"> 171 200 <DependentUpon>DiscriminantFunctionClassificationSolutionView.cs</DependentUpon> 172 201 </Compile> 173 <Compile Include="Interfaces\IDataAnalysisSolutionEvaluationView.cs" /> 174 <Compile Include="Interfaces\IDiscriminantFunctionClassificationSolutionEvaluationView.cs" /> 175 <Compile Include="Interfaces\IClusteringSolutionEvaluationView.cs" /> 176 <Compile Include="Interfaces\IClassificationSolutionEvaluationView.cs" /> 177 <Compile Include="DataAnalysisSolutionView.cs"> 178 <SubType>UserControl</SubType> 179 </Compile> 180 <Compile Include="DataAnalysisSolutionView.Designer.cs"> 202 <Compile Include="Solution Views\DataAnalysisSolutionView.cs"> 203 <SubType>UserControl</SubType> 204 </Compile> 205 <Compile Include="Solution Views\DataAnalysisSolutionView.Designer.cs"> 181 206 <DependentUpon>DataAnalysisSolutionView.cs</DependentUpon> 182 207 </Compile> … … 187 212 <DependentUpon>DoubleLimitView.cs</DependentUpon> 188 213 </Compile> 189 <Compile Include="Interfaces\IRegressionSolutionEvaluationView.cs" /> 190 <Compile Include="RegressionSolutionView.cs"> 191 <SubType>UserControl</SubType> 192 </Compile> 193 <Compile Include="RegressionSolutionView.Designer.cs"> 214 <Compile Include="Interfaces\IDataAnalysisSolutionEvaluationView.cs" /> 215 <Compile Include="MenuItems\CreateEnsembleMenuItem.cs" /> 216 <Compile Include="Solution Views\NamedDataAnalysisSolutionView.cs"> 217 <SubType>UserControl</SubType> 218 </Compile> 219 <Compile Include="Solution Views\NamedDataAnalysisSolutionView.Designer.cs"> 220 <DependentUpon>NamedDataAnalysisSolutionView.cs</DependentUpon> 221 </Compile> 222 <Compile Include="Solution Views\RegressionEnsembleSolutionView.cs"> 223 <SubType>UserControl</SubType> 224 </Compile> 225 <Compile Include="Solution Views\RegressionEnsembleSolutionView.Designer.cs"> 226 <DependentUpon>RegressionEnsembleSolutionView.cs</DependentUpon> 227 </Compile> 228 <Compile Include="Solution Views\RegressionSolutionView.cs"> 229 <SubType>UserControl</SubType> 230 </Compile> 231 <Compile Include="Solution Views\RegressionSolutionView.Designer.cs"> 194 232 <DependentUpon>RegressionSolutionView.cs</DependentUpon> 195 </Compile>196 <Compile Include="Regression\RegressionEnsembleSolutionLineChartView.cs">197 <SubType>UserControl</SubType>198 </Compile>199 <Compile Include="Regression\RegressionEnsembleSolutionLineChartView.Designer.cs">200 <DependentUpon>RegressionEnsembleSolutionLineChartView.cs</DependentUpon>201 </Compile>202 <Compile Include="Regression\RegressionEnsembleSolutionScatterPlotView.cs">203 <SubType>UserControl</SubType>204 </Compile>205 <Compile Include="Regression\RegressionEnsembleSolutionScatterPlotView.Designer.cs">206 <DependentUpon>RegressionEnsembleSolutionScatterPlotView.cs</DependentUpon>207 233 </Compile> 208 234 <Compile Include="Regression\RegressionSolutionEstimatedValuesView.cs"> … … 288 314 <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project> 289 315 <Name>HeuristicLab.Optimization-3.3</Name> 316 </ProjectReference> 317 <ProjectReference Include="..\..\HeuristicLab.Optimizer\3.3\HeuristicLab.Optimizer-3.3.csproj"> 318 <Project>{C664305E-497C-4533-A140-967DEDB05C19}</Project> 319 <Name>HeuristicLab.Optimizer-3.3</Name> 290 320 </ProjectReference> 291 321 <ProjectReference Include="..\..\HeuristicLab.Parameters.Views\3.3\HeuristicLab.Parameters.Views-3.3.csproj"> … … 327 357 </BootstrapperPackage> 328 358 </ItemGroup> 329 <ItemGroup />330 359 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 331 360 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLabProblemsDataAnalysisViewsPlugin.cs.frame
r5869 r6760 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis.Views { 28 [Plugin("HeuristicLab.Problems.DataAnalysis.Views", "Provides views for base classes for data analysis tasks.", "3.4. 0.$WCREV$")]28 [Plugin("HeuristicLab.Problems.DataAnalysis.Views", "Provides views for base classes for data analysis tasks.", "3.4.1.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.DataAnalysis.Views-3.4.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.ALGLIB","3.1.0.0")] … … 39 39 [PluginDependency("HeuristicLab.Optimization","3.3")] 40 40 [PluginDependency("HeuristicLab.Optimization.Views","3.3")] 41 [PluginDependency("HeuristicLab.Optimizer", "3.3")] 41 42 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")] 42 43 [PluginDependency("HeuristicLab.Visualization.ChartControlsExtensions", "3.3")] -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Properties/AssemblyInfo.frame
r5869 r6760 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.4.0.0")] 55 [assembly: AssemblyFileVersion("3.4. 0.$WCREV$")]55 [assembly: AssemblyFileVersion("3.4.1.$WCREV$")] -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.cs
r6058 r6760 22 22 using System.Linq; 23 23 using System.Windows.Forms; 24 using HeuristicLab.Core.Views;25 24 using HeuristicLab.Data; 26 25 using HeuristicLab.Data.Views; … … 31 30 [View("Estimated Values")] 32 31 [Content(typeof(IRegressionSolution))] 33 public partial class RegressionSolutionEstimatedValuesView : ItemView, IRegressionSolutionEvaluationView { 34 private const string TARGETVARIABLE_SERIES_NAME = "TargetVariable"; 35 private const string ESTIMATEDVALUES_SERIES_NAME = "EstimatedValues"; 32 public partial class RegressionSolutionEstimatedValuesView : DataAnalysisSolutionEvaluationView { 33 private const string TARGETVARIABLE_SERIES_NAME = "Target Variable"; 34 private const string ESTIMATEDVALUES_SERIES_NAME = "Estimated Values (all)"; 35 private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Values (training)"; 36 private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Values (test)"; 36 37 37 38 public new IRegressionSolution Content { … … 83 84 if (InvokeRequired) Invoke((Action)UpdateEstimatedValues); 84 85 else { 85 DoubleMatrix matrix = null;86 StringMatrix matrix = null; 86 87 if (Content != null) { 87 double[,] values = new double[Content.ProblemData.Dataset.Rows, 4];88 string[,] values = new string[Content.ProblemData.Dataset.Rows, 7]; 88 89 89 double[] target = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable); 90 double[] estimated = Content.EstimatedValues.ToArray(); 91 for (int row = 0; row < target.Length; row++) { 92 values[row, 0] = target[row]; 93 values[row, 1] = estimated[row]; 94 values[row, 2] = Math.Abs(estimated[row] - target[row]); 95 values[row, 3] = Math.Abs(values[row, 2] / target[row]); 90 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 91 var estimated = Content.EstimatedValues.GetEnumerator(); 92 var estimated_training = Content.EstimatedTrainingValues.GetEnumerator(); 93 var estimated_test = Content.EstimatedTestValues.GetEnumerator(); 94 95 foreach (var row in Content.ProblemData.TrainingIndizes) { 96 estimated_training.MoveNext(); 97 values[row, 3] = estimated_training.Current.ToString(); 96 98 } 97 99 98 matrix = new DoubleMatrix(values); 99 matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME, "Absolute Error", "Relative Error" }; 100 foreach (var row in Content.ProblemData.TestIndizes) { 101 estimated_test.MoveNext(); 102 values[row, 4] = estimated_test.Current.ToString(); 103 } 104 105 foreach (var row in Enumerable.Range(0, Content.ProblemData.Dataset.Rows)) { 106 estimated.MoveNext(); 107 double est = estimated.Current; 108 double res = Math.Abs(est - target[row]); 109 values[row, 0] = row.ToString(); 110 values[row, 1] = target[row].ToString(); 111 values[row, 2] = est.ToString(); 112 values[row, 5] = Math.Abs(res).ToString(); 113 values[row, 6] = Math.Abs(res / est).ToString(); 114 } 115 116 matrix = new StringMatrix(values); 117 matrix.ColumnNames = new string[] { "Id", TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME, "Absolute Error (all)", "Relative Error (all)" }; 118 matrix.SortableView = true; 100 119 } 101 120 matrixView.Content = matrix; -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.Designer.cs
r5809 r6760 63 63 this.chart.Size = new System.Drawing.Size(358, 225); 64 64 this.chart.TabIndex = 0; 65 this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend); 65 66 this.chart.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.Chart_MouseDoubleClick); 67 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); 68 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 66 69 // 67 // LineChartView70 // RegressionSolutionLineChartView 68 71 // 69 72 this.AllowDrop = true; … … 71 74 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 72 75 this.Controls.Add(this.chart); 73 this.Name = " LineChartView";76 this.Name = "RegressionSolutionLineChartView"; 74 77 this.Size = new System.Drawing.Size(358, 225); 75 78 ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs
r5975 r6760 20 20 #endregion 21 21 using System; 22 using System.Collections.Generic; 22 23 using System.Drawing; 23 24 using System.Linq; 24 25 using System.Windows.Forms; 25 26 using System.Windows.Forms.DataVisualization.Charting; 26 using HeuristicLab.Core.Views;27 27 using HeuristicLab.MainForm; 28 28 using HeuristicLab.MainForm.WindowsForms; … … 31 31 [View("Line Chart")] 32 32 [Content(typeof(IRegressionSolution))] 33 public partial class RegressionSolutionLineChartView : ItemView, IRegressionSolutionEvaluationView { 34 private const string TARGETVARIABLE_SERIES_NAME = "TargetVariable"; 35 private const string ESTIMATEDVALUES_SERIES_NAME = "EstimatedValues"; 33 public partial class RegressionSolutionLineChartView : DataAnalysisSolutionEvaluationView { 34 private const string TARGETVARIABLE_SERIES_NAME = "Target Variable"; 35 private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Values (training)"; 36 private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Values (test)"; 37 private const string ESTIMATEDVALUES_ALL_SERIES_NAME = "Estimated Values (all samples)"; 36 38 37 39 public new IRegressionSolution Content { … … 47 49 this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true; 48 50 this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true; 51 this.chart.ChartAreas[0].AxisX.IsStartedFromZero = true; 49 52 this.chart.ChartAreas[0].CursorX.Interval = 1; 50 53 … … 57 60 this.chart.Series.Clear(); 58 61 if (Content != null) { 62 this.chart.ChartAreas[0].AxisX.Minimum = 0; 63 this.chart.ChartAreas[0].AxisX.Maximum = Content.ProblemData.Dataset.Rows - 1; 64 59 65 this.chart.Series.Add(TARGETVARIABLE_SERIES_NAME); 60 66 this.chart.Series[TARGETVARIABLE_SERIES_NAME].LegendText = Content.ProblemData.TargetVariable; 61 67 this.chart.Series[TARGETVARIABLE_SERIES_NAME].ChartType = SeriesChartType.FastLine; 62 this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindY(Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable)); 68 this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindXY(Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray(), 69 Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray()); 70 71 this.chart.Series.Add(ESTIMATEDVALUES_TRAINING_SERIES_NAME); 72 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].LegendText = ESTIMATEDVALUES_TRAINING_SERIES_NAME; 73 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine; 74 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), Content.EstimatedTrainingValues.ToArray()); 75 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Tag = Content; 76 this.chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, ESTIMATEDVALUES_TRAINING_SERIES_NAME); 77 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.BorderWidth = 0; 78 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.MarkerStyle = MarkerStyle.None; 79 80 81 this.chart.Series.Add(ESTIMATEDVALUES_TEST_SERIES_NAME); 82 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME; 83 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine; 84 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), Content.EstimatedTestValues.ToArray()); 85 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content; 86 87 88 int[] allIndizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray(); 89 var estimatedValues = Content.EstimatedValues.ToArray(); 90 List<double> allEstimatedValues = allIndizes.Select(index => estimatedValues[index]).ToList(); 91 92 this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME); 93 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME; 94 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine; 95 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndizes, allEstimatedValues); 96 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content; 97 this.chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, ESTIMATEDVALUES_ALL_SERIES_NAME); 98 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.BorderWidth = 0; 99 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.MarkerStyle = MarkerStyle.None; 100 this.ToggleSeriesData(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 101 102 UpdateCursorInterval(); 63 103 this.UpdateStripLines(); 64 65 this.chart.Series.Add(ESTIMATEDVALUES_SERIES_NAME);66 this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].LegendText = Content.ItemName;67 this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].ChartType = SeriesChartType.FastLine;68 this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].Points.DataBindY(Content.EstimatedValues.ToArray());69 this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].Tag = Content;70 UpdateCursorInterval();71 104 } 72 105 } 73 106 74 107 private void UpdateCursorInterval() { 75 var estimatedValues = this.chart.Series[ESTIMATEDVALUES_ SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0);108 var estimatedValues = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0); 76 109 var targetValues = this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0); 77 110 double estimatedValuesRange = estimatedValues.Max() - estimatedValues.Min(); … … 95 128 } 96 129 97 private void Content_ProblemDataChanged(object sender, EventArgs e) {98 RedrawChart();99 }100 101 private void Content_ModelChanged(object sender, EventArgs e) {102 UpdateEstimatedValuesLineChart();103 }104 105 130 protected override void OnContentChanged() { 106 131 base.OnContentChanged(); 107 132 RedrawChart(); 108 133 } 109 110 private void UpdateEstimatedValuesLineChart() { 111 if (InvokeRequired) Invoke((Action)UpdateEstimatedValuesLineChart); 112 else { 113 if (this.chart.Series.Count > 0) { 114 Series s = this.chart.Series.SingleOrDefault(x => x.Tag == Content); 115 if (s != null) { 116 s.Points.DataBindY(Content.EstimatedValues.ToArray()); 117 s.LegendText = Content.ItemName; 118 this.UpdateStripLines(); 119 UpdateCursorInterval(); 120 } 121 } 122 } 123 } 134 private void Content_ProblemDataChanged(object sender, EventArgs e) { 135 RedrawChart(); 136 } 137 private void Content_ModelChanged(object sender, EventArgs e) { 138 RedrawChart(); 139 } 140 141 124 142 125 143 private void Chart_MouseDoubleClick(object sender, MouseEventArgs e) { … … 136 154 private void UpdateStripLines() { 137 155 this.chart.ChartAreas[0].AxisX.StripLines.Clear(); 138 this.CreateAndAddStripLine("Training", Color.FromArgb(20, Color.Green), 139 Content.ProblemData.TrainingPartition.Start, 140 Content.ProblemData.TrainingPartition.End); 141 this.CreateAndAddStripLine("Test", Color.FromArgb(20, Color.Red), 142 Content.ProblemData.TestPartition.Start, 143 Content.ProblemData.TestPartition.End); 144 } 145 146 private void CreateAndAddStripLine(string title, Color c, int start, int end) { 156 157 int[] attr = new int[Content.ProblemData.Dataset.Rows + 1]; // add a virtual last row that is again empty to simplify loop further down 158 foreach (var row in Content.ProblemData.TrainingIndizes) { 159 attr[row] += 1; 160 } 161 foreach (var row in Content.ProblemData.TestIndizes) { 162 attr[row] += 2; 163 } 164 int start = 0; 165 int curAttr = attr[start]; 166 for (int row = 0; row < attr.Length; row++) { 167 if (attr[row] != curAttr) { 168 switch (curAttr) { 169 case 0: break; 170 case 1: 171 this.CreateAndAddStripLine("Training", start, row, Color.FromArgb(40, Color.Green), Color.Transparent); 172 break; 173 case 2: 174 this.CreateAndAddStripLine("Test", start, row, Color.FromArgb(40, Color.Red), Color.Transparent); 175 break; 176 case 3: 177 this.CreateAndAddStripLine("Training and Test", start, row, Color.FromArgb(40, Color.Green), Color.FromArgb(40, Color.Red), ChartHatchStyle.WideUpwardDiagonal); 178 break; 179 default: 180 // should not happen 181 break; 182 } 183 curAttr = attr[row]; 184 start = row; 185 } 186 } 187 } 188 189 private void CreateAndAddStripLine(string title, int start, int end, Color color, Color secondColor, ChartHatchStyle hatchStyle = ChartHatchStyle.None) { 147 190 StripLine stripLine = new StripLine(); 148 stripLine.BackColor = c; 191 stripLine.BackColor = color; 192 stripLine.BackSecondaryColor = secondColor; 193 stripLine.BackHatchStyle = hatchStyle; 149 194 stripLine.Text = title; 150 195 stripLine.Font = new Font("Times New Roman", 12, FontStyle.Bold); 196 // strip range is [start .. end] inclusive, but we evaluate [start..end[ (end is exclusive) 197 // the strip should be by one longer (starting at start - 0.5 and ending at end + 0.5) 151 198 stripLine.StripWidth = end - start; 152 stripLine.IntervalOffset = start ;199 stripLine.IntervalOffset = start - 0.5; // start slightly to the left of the first point to clearly indicate the first point in the partition 153 200 this.chart.ChartAreas[0].AxisX.StripLines.Add(stripLine); 201 } 202 203 private void ToggleSeriesData(Series series) { 204 if (series.Points.Count > 0) { //checks if series is shown 205 if (this.chart.Series.Any(s => s != series && s.Points.Count > 0)) { 206 series.Points.Clear(); 207 } 208 } else if (Content != null) { 209 string targetVariableName = Content.ProblemData.TargetVariable; 210 211 IEnumerable<int> indizes = null; 212 IEnumerable<double> predictedValues = null; 213 switch (series.Name) { 214 case ESTIMATEDVALUES_ALL_SERIES_NAME: 215 indizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray(); 216 var estimatedValues = Content.EstimatedValues.ToArray(); 217 predictedValues = indizes.Select(index => estimatedValues[index]).ToList(); 218 break; 219 case ESTIMATEDVALUES_TRAINING_SERIES_NAME: 220 indizes = Content.ProblemData.TrainingIndizes.ToArray(); 221 predictedValues = Content.EstimatedTrainingValues.ToArray(); 222 break; 223 case ESTIMATEDVALUES_TEST_SERIES_NAME: 224 indizes = Content.ProblemData.TestIndizes.ToArray(); 225 predictedValues = Content.EstimatedTestValues.ToArray(); 226 break; 227 } 228 series.Points.DataBindXY(indizes, predictedValues); 229 chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, series.Name); 230 chart.Legends[series.Legend].ForeColor = Color.Black; 231 UpdateCursorInterval(); 232 } 233 } 234 235 private void chart_MouseMove(object sender, MouseEventArgs e) { 236 HitTestResult result = chart.HitTest(e.X, e.Y); 237 if (result.ChartElementType == ChartElementType.LegendItem && result.Series.Name != TARGETVARIABLE_SERIES_NAME) 238 Cursor = Cursors.Hand; 239 else 240 Cursor = Cursors.Default; 241 } 242 private void chart_MouseDown(object sender, MouseEventArgs e) { 243 HitTestResult result = chart.HitTest(e.X, e.Y); 244 if (result.ChartElementType == ChartElementType.LegendItem && result.Series.Name != TARGETVARIABLE_SERIES_NAME) { 245 ToggleSeriesData(result.Series); 246 } 247 } 248 249 private void chart_CustomizeLegend(object sender, CustomizeLegendEventArgs e) { 250 if (chart.Series.Count != 4) return; 251 e.LegendItems[0].Cells[1].ForeColor = this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 252 e.LegendItems[1].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 253 e.LegendItems[2].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 254 e.LegendItems[3].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 154 255 } 155 256 } -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.Designer.cs
r5809 r6760 64 64 this.chart.Size = new System.Drawing.Size(527, 392); 65 65 this.chart.TabIndex = 1; 66 this.chart.PostPaint += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.ChartPaintEventArgs>(this.chart_PostPaint); 67 this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend); 68 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); 66 69 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 67 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown);68 this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(chart_CustomizeLegend);69 70 // 70 // ScatterPlotView71 // RegressionSolutionScatterPlotView 71 72 // 73 this.AllowDrop = true; 72 74 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 73 75 this.Controls.Add(this.chart); 74 this.Name = "ScatterPlotView"; 75 this.AllowDrop = true; 76 this.Name = "RegressionSolutionScatterPlotView"; 76 77 this.Size = new System.Drawing.Size(527, 392); 77 78 ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); -
branches/PersistenceSpeedUp/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs
r5975 r6760 25 25 using System.Windows.Forms; 26 26 using System.Windows.Forms.DataVisualization.Charting; 27 using HeuristicLab.Core.Views;28 27 using HeuristicLab.MainForm; 29 28 using HeuristicLab.MainForm.WindowsForms; … … 32 31 [View("Scatter Plot")] 33 32 [Content(typeof(IRegressionSolution))] 34 public partial class RegressionSolutionScatterPlotView : ItemView, IRegressionSolutionEvaluationView {33 public partial class RegressionSolutionScatterPlotView : DataAnalysisSolutionEvaluationView { 35 34 private const string ALL_SERIES = "All samples"; 36 35 private const string TRAINING_SERIES = "Training samples"; … … 131 130 if (this.chart.Series[ALL_SERIES].Points.Count > 0) 132 131 this.chart.Series[ALL_SERIES].Points.DataBindXY(Content.EstimatedValues.ToArray(), "", 133 dataset.Get VariableValues(targetVariableName), "");132 dataset.GetDoubleValues(targetVariableName).ToArray(), ""); 134 133 if (this.chart.Series[TRAINING_SERIES].Points.Count > 0) 135 134 this.chart.Series[TRAINING_SERIES].Points.DataBindXY(Content.EstimatedTrainingValues.ToArray(), "", 136 dataset.Get EnumeratedVariableValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray(), "");135 dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray(), ""); 137 136 if (this.chart.Series[TEST_SERIES].Points.Count > 0) 138 137 this.chart.Series[TEST_SERIES].Points.DataBindXY(Content.EstimatedTestValues.ToArray(), "", 139 dataset.Get EnumeratedVariableValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray(), "");140 141 double max = Math.Max(Content.EstimatedValues.Max(), dataset.GetVariableValues(targetVariableName).Max());142 double min = Math.Min(Content.EstimatedValues.Min(), dataset.GetVariableValues(targetVariableName).Min());138 dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray(), ""); 139 140 double max = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Max(); 141 double min = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetDoubleValues(targetVariableName)))).Min(); 143 142 144 143 max = max + 0.2 * Math.Abs(max); … … 178 177 case ALL_SERIES: 179 178 predictedValues = Content.EstimatedValues.ToArray(); 180 targetValues = Content.ProblemData.Dataset.Get VariableValues(targetVariableName);179 targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName).ToArray(); 181 180 break; 182 181 case TRAINING_SERIES: 183 182 predictedValues = Content.EstimatedTrainingValues.ToArray(); 184 targetValues = Content.ProblemData.Dataset.Get EnumeratedVariableValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray();183 targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TrainingIndizes).ToArray(); 185 184 break; 186 185 case TEST_SERIES: 187 186 predictedValues = Content.EstimatedTestValues.ToArray(); 188 targetValues = Content.ProblemData.Dataset.Get EnumeratedVariableValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray();187 targetValues = Content.ProblemData.Dataset.GetDoubleValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray(); 189 188 break; 190 189 } … … 220 219 e.LegendItems[2].Cells[1].ForeColor = this.chart.Series[TEST_SERIES].Points.Count == 0 ? Color.Gray : Color.Black; 221 220 } 221 222 private void chart_PostPaint(object sender, ChartPaintEventArgs e) { 223 var chartArea = e.ChartElement as ChartArea; 224 if (chartArea != null) { 225 ChartGraphics chartGraphics = e.ChartGraphics; 226 using (Pen p = new Pen(Color.DarkGray)) { 227 double xmin = chartArea.AxisX.ScaleView.ViewMinimum; 228 double xmax = chartArea.AxisX.ScaleView.ViewMaximum; 229 double ymin = chartArea.AxisY.ScaleView.ViewMinimum; 230 double ymax = chartArea.AxisY.ScaleView.ViewMaximum; 231 232 if (xmin > ymax || ymin > xmax) return; 233 234 PointF start = PointF.Empty; 235 start.X = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisX.AxisName, Math.Max(xmin, ymin)); 236 start.Y = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisY.AxisName, Math.Max(xmin, ymin)); 237 PointF end = PointF.Empty; 238 end.X = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisX.AxisName, Math.Min(xmax, ymax)); 239 end.Y = (float)chartGraphics.GetPositionFromAxis(chartArea.Name, chartArea.AxisY.AxisName, Math.Min(xmax, ymax)); 240 241 chartGraphics.Graphics.DrawLine(p, chartGraphics.GetAbsolutePoint(start), chartGraphics.GetAbsolutePoint(end)); 242 } 243 } 244 } 222 245 } 223 246 }
Note: See TracChangeset
for help on using the changeset viewer.