- Timestamp:
- 11/28/11 13:47:28 (13 years ago)
- Location:
- branches/RegressionBenchmarks
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RegressionBenchmarks
- Property svn:ignore
-
old new 4 4 *.suo 5 5 *.vsp 6 Doxygen 6 7 Google.ProtocolBuffers-0.9.1.dll 7 8 HeuristicLab 3.3.5.1.ReSharper.user 8 9 HeuristicLab 3.3.6.0.ReSharper.user 9 10 HeuristicLab.4.5.resharper.user 11 HeuristicLab.ExtLibs.6.0.ReSharper.user 10 12 HeuristicLab.resharper.user 11 13 ProtoGen.exe … … 16 18 bin 17 19 protoc.exe 18 HeuristicLab.ExtLibs.6.0.ReSharper.user19 Doxygen
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionEstimatedClassValuesView.cs
r6740 r7085 24 24 using System.Linq; 25 25 using System.Windows.Forms; 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Data; 27 28 using HeuristicLab.MainForm; … … 96 97 97 98 int classValuesCount = Content.ProblemData.ClassValues.Count; 98 int modelCount = Content.Model.Models.Count();99 string[,] values = new string[indizes.Length, 5 + classValuesCount + modelCount];99 int solutionsCount = Content.ClassificationSolutions.Count(); 100 string[,] values = new string[indizes.Length, 5 + classValuesCount + solutionsCount]; 100 101 double[] target = Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray(); 101 102 List<List<double?>> estimatedValuesVector = GetEstimatedValues(SamplesComboBox.SelectedItem.ToString(), indizes, … … 106 107 values[i, 0] = row.ToString(); 107 108 values[i, 1] = target[i].ToString(); 108 values[i, 2] = estimatedClassValues[i].ToString(); 109 values[i, 3] = (target[i] == estimatedClassValues[i]).ToString(); 110 var groups = estimatedValuesVector[i].GroupBy(x => x).Select(g => new { Key = g.Key, Count = g.Count() }).ToList(); 111 var estimationCount = groups.Where(g => g.Key != null).Select(g => g.Count).Sum(); 112 values[i, 4] = (((double)groups.Where(g => g.Key == estimatedClassValues[i]).Single().Count) / estimationCount).ToString(); 113 for (int classIndex = 0; classIndex < Content.ProblemData.ClassValues.Count; classIndex++) { 114 var group = groups.Where(g => g.Key == Content.ProblemData.ClassValues[classIndex]).SingleOrDefault(); 115 if (group == null) values[i, 5 + classIndex] = 0.ToString(); 116 else values[i, 5 + classIndex] = group.Count.ToString(); 109 //display only indices and target values if no models are present 110 if (solutionsCount > 0) { 111 values[i, 2] = estimatedClassValues[i].ToString(); 112 values[i, 3] = (target[i].IsAlmost(estimatedClassValues[i])).ToString(); 113 var groups = 114 estimatedValuesVector[i].GroupBy(x => x).Select(g => new { Key = g.Key, Count = g.Count() }).ToList(); 115 var estimationCount = groups.Where(g => g.Key != null).Select(g => g.Count).Sum(); 116 values[i, 4] = 117 (((double)groups.Where(g => g.Key == estimatedClassValues[i]).Single().Count) / estimationCount).ToString(); 118 for (int classIndex = 0; classIndex < Content.ProblemData.ClassValues.Count; classIndex++) { 119 var group = groups.Where(g => g.Key == Content.ProblemData.ClassValues[classIndex]).SingleOrDefault(); 120 if (group == null) values[i, 5 + classIndex] = 0.ToString(); 121 else values[i, 5 + classIndex] = group.Count.ToString(); 122 } 123 for (int modelIndex = 0; modelIndex < estimatedValuesVector[i].Count; modelIndex++) { 124 values[i, 5 + classValuesCount + modelIndex] = estimatedValuesVector[i][modelIndex] == null 125 ? string.Empty 126 : estimatedValuesVector[i][modelIndex].ToString(); 127 } 117 128 } 118 for (int modelIndex = 0; modelIndex < estimatedValuesVector[i].Count; modelIndex++) {119 values[i, 5 + classValuesCount + modelIndex] = estimatedValuesVector[i][modelIndex] == null120 ? string.Empty121 : estimatedValuesVector[i][modelIndex].ToString();122 }123 124 129 } 125 130 … … 131 136 matrix.SortableView = true; 132 137 matrixView.Content = matrix; 133 UpdateColoringOfRows();134 138 } 135 139 … … 162 166 return; 163 167 } 164 bool correctClassified = bool.Parse(matrixView.DataGridView[3, e.RowIndex].Value.ToString()); 168 var cellValue = matrixView.DataGridView[3, e.RowIndex].Value.ToString(); 169 if (string.IsNullOrEmpty(cellValue)) return; 170 bool correctClassified = bool.Parse(cellValue); 165 171 matrixView.DataGridView.Rows[e.RowIndex].DefaultCellStyle.ForeColor = correctClassified ? Color.MediumSeaGreen : Color.Red; 166 }167 168 private void UpdateColoringOfRows() {169 if (InvokeRequired) {170 Invoke((Action)UpdateColoringOfRows);171 return;172 }173 //matrixView.DataGridView.SuspendRepaint();174 //for (int i = 0; i < matrixView.DataGridView.Rows.Count; i++) {175 // bool correctClassified = bool.Parse(matrixView.Content.GetValue(i, 3));176 // matrixView.DataGridView.Rows[i].DefaultCellStyle.ForeColor = correctClassified ? Color.MediumSeaGreen : Color.Red;177 //}178 //matrixView.DataGridView.ResumeRepaint(true);179 172 } 180 173 } -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/DataAnalysisProblemView.Designer.cs
r6968 r7085 49 49 this.benchmarkComboBox = new System.Windows.Forms.ComboBox(); 50 50 this.loadButton = new System.Windows.Forms.Button(); 51 this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 51 52 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 53 this.tableLayoutPanel1.SuspendLayout(); 52 54 this.SuspendLayout(); 53 55 // 54 56 // parameterCollectionView 55 57 // 56 this.parameterCollectionView.Location = new System.Drawing.Point(3, 55);57 this.parameterCollectionView.Size = new System.Drawing.Size(490, 2 79);58 this.parameterCollectionView.Location = new System.Drawing.Point(3, 80); 59 this.parameterCollectionView.Size = new System.Drawing.Size(490, 254); 58 60 this.parameterCollectionView.TabIndex = 4; 59 61 // … … 74 76 this.importButton.Location = new System.Drawing.Point(3, 24); 75 77 this.importButton.Name = "importButton"; 76 this.importButton.Size = new System.Drawing.Size( 243, 23);78 this.importButton.Size = new System.Drawing.Size(487, 23); 77 79 this.importButton.TabIndex = 3; 78 80 this.importButton.Text = "Import from CSV file"; … … 82 84 // openFileDialog 83 85 // 84 this.openFileDialog.FileName = "openFileDialog"; 86 this.openFileDialog.Filter = "CSV files|*.csv|Text files|*.txt|All files|*.*"; 87 this.openFileDialog.Title = "Import data..."; 85 88 // 86 89 // benchmarkComboBox 87 90 // 88 this.benchmarkComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 91 this.benchmarkComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 92 | System.Windows.Forms.AnchorStyles.Right))); 89 93 this.benchmarkComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 90 94 this.benchmarkComboBox.FormattingEnabled = true; 91 this.benchmarkComboBox.Location = new System.Drawing.Point( 252, 25);95 this.benchmarkComboBox.Location = new System.Drawing.Point(3, 3); 92 96 this.benchmarkComboBox.Name = "benchmarkComboBox"; 93 this.benchmarkComboBox.Size = new System.Drawing.Size( 183, 21);97 this.benchmarkComboBox.Size = new System.Drawing.Size(240, 21); 94 98 this.benchmarkComboBox.TabIndex = 5; 95 99 // 96 100 // loadButton 97 101 // 98 this.loadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 99 this.loadButton.Location = new System.Drawing.Point(439, 24); 102 this.loadButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 103 | System.Windows.Forms.AnchorStyles.Right))); 104 this.loadButton.Location = new System.Drawing.Point(249, 2); 105 this.loadButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 3); 100 106 this.loadButton.Name = "loadButton"; 101 this.loadButton.Size = new System.Drawing.Size( 50, 23);107 this.loadButton.Size = new System.Drawing.Size(241, 23); 102 108 this.loadButton.TabIndex = 6; 103 109 this.loadButton.Text = "Load"; … … 105 111 this.loadButton.Click += new System.EventHandler(this.loadButton_Click); 106 112 // 113 // tableLayoutPanel1 114 // 115 this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 116 | System.Windows.Forms.AnchorStyles.Right))); 117 this.tableLayoutPanel1.ColumnCount = 2; 118 this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 119 this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 120 this.tableLayoutPanel1.Controls.Add(this.benchmarkComboBox, 0, 0); 121 this.tableLayoutPanel1.Controls.Add(this.loadButton, 1, 0); 122 this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 51); 123 this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 124 this.tableLayoutPanel1.RowCount = 1; 125 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 126 this.tableLayoutPanel1.Size = new System.Drawing.Size(493, 28); 127 this.tableLayoutPanel1.TabIndex = 7; 128 // 107 129 // DataAnalysisProblemView 108 130 // 109 131 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 110 132 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 111 this.Controls.Add(this.loadButton);112 133 this.Controls.Add(this.importButton); 113 this.Controls.Add(this. benchmarkComboBox);134 this.Controls.Add(this.tableLayoutPanel1); 114 135 this.Name = "DataAnalysisProblemView"; 115 136 this.Size = new System.Drawing.Size(493, 334); 116 this.Controls.SetChildIndex(this. benchmarkComboBox, 0);137 this.Controls.SetChildIndex(this.tableLayoutPanel1, 0); 117 138 this.Controls.SetChildIndex(this.importButton, 0); 118 this.Controls.SetChildIndex(this. loadButton, 0);139 this.Controls.SetChildIndex(this.parameterCollectionView, 0); 119 140 this.Controls.SetChildIndex(this.infoLabel, 0); 120 141 this.Controls.SetChildIndex(this.nameTextBox, 0); 121 142 this.Controls.SetChildIndex(this.nameLabel, 0); 122 this.Controls.SetChildIndex(this.parameterCollectionView, 0);123 143 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 144 this.tableLayoutPanel1.ResumeLayout(false); 124 145 this.ResumeLayout(false); 125 146 this.PerformLayout(); … … 133 154 private System.Windows.Forms.ComboBox benchmarkComboBox; 134 155 private System.Windows.Forms.Button loadButton; 156 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 135 157 } 136 158 } -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/DataAnalysisProblemView.cs
r7044 r7085 24 24 using System.Linq; 25 25 using System.Windows.Forms; 26 using HeuristicLab.Common; 26 27 using HeuristicLab.MainForm; 27 28 using HeuristicLab.Optimization.Views; … … 65 66 base.OnContentChanged(); 66 67 benchmarkComboBox.Items.Clear(); 67 benchmarkComboBox.Items.AddRange(GetBenchmarkProblemDataGenerators().OrderBy(b => b.Name ).ToArray());68 benchmarkComboBox.Items.AddRange(GetBenchmarkProblemDataGenerators().OrderBy(b => b.Name, new NaturalStringComparer()).ToArray()); 68 69 if (benchmarkComboBox.Items.Count > 0) 69 70 benchmarkComboBox.SelectedIndex = 0; -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/DataAnalysisProblemView.resx
r6969 r7085 121 121 <value>107, 17</value> 122 122 </metadata> 123 <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 <value>107, 17</value> 125 </metadata> 123 126 <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 127 <value>17, 17</value> -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.Designer.cs
r6642 r7085 49 49 this.chart.TabIndex = 0; 50 50 this.chart.Text = "chart"; 51 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); 51 52 // 52 53 // label1 -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs
r6750 r7085 31 31 [Content(typeof(IRegressionSolution))] 32 32 public partial class RegressionSolutionErrorCharacteristicsCurveView : DataAnalysisSolutionEvaluationView { 33 private IRegressionSolution constantModel; 33 34 protected const string TrainingSamples = "Training"; 34 35 protected const string TestSamples = "Test"; … … 101 102 if (Content == null) return; 102 103 103 var originalValues = GetOriginalValues(); 104 var meanModelEstimatedValues = GetMeanModelEstimatedValues(originalValues); 104 var originalValues = GetOriginalValues().ToList(); 105 constantModel = CreateConstantModel(); 106 var meanModelEstimatedValues = GetEstimatedValues(constantModel); 105 107 var meanModelResiduals = GetResiduals(originalValues, meanModelEstimatedValues); 106 108 … … 113 115 UpdateSeries(meanModelResiduals, meanModelSeries); 114 116 meanModelSeries.ToolTip = "Area over Curve: " + CalculateAreaOverCurve(meanModelSeries); 117 meanModelSeries.Tag = constantModel; 115 118 chart.Series.Add(meanModelSeries); 116 119 … … 133 136 series.Points.Clear(); 134 137 residuals.Sort(); 138 if (!residuals.Any() || residuals.All(double.IsNaN)) return; 135 139 136 140 series.Points.AddXY(0, 0); … … 146 150 147 151 point.XValue = residuals[i]; 148 point.YValues[0] = ((double)i +1) / residuals.Count;152 point.YValues[0] = ((double)i + 1) / residuals.Count; 149 153 point.ToolTip = "Error: " + point.XValue + "\n" + "Samples: " + point.YValues[0]; 150 154 series.Points.Add(point); … … 206 210 207 211 private double CalculateAreaOverCurve(Series series) { 208 if (series.Points.Count < 1) throw new ArgumentException("Could not calculate area under curve if less than 1 data points were given.");212 if (series.Points.Count < 1) return 0; 209 213 210 214 double auc = 0.0; … … 224 228 else UpdateChart(); 225 229 } 230 231 #region Mean Model 232 private void chart_MouseDown(object sender, MouseEventArgs e) { 233 if (e.Clicks < 2) return; 234 HitTestResult result = chart.HitTest(e.X, e.Y); 235 if (result.ChartElementType != ChartElementType.LegendItem) return; 236 if (result.Series.Name != constantModel.Name) return; 237 238 MainFormManager.MainForm.ShowContent((IRegressionSolution)result.Series.Tag); 239 } 240 241 private IRegressionSolution CreateConstantModel() { 242 double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes).Average(); 243 var solution = new ConstantRegressionModel(averageTrainingTarget).CreateRegressionSolution(ProblemData); 244 solution.Name = "Mean Model"; 245 return solution; 246 } 247 #endregion 226 248 } 227 249 } -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs
r6740 r7085 20 20 #endregion 21 21 using System; 22 using System.Collections.Generic;23 22 using System.Drawing; 24 23 using System.Linq; … … 172 171 string targetVariableName = Content.ProblemData.TargetVariable; 173 172 174 IEnumerable<double>predictedValues = null;175 IEnumerable<double>targetValues = null;173 double[] predictedValues = null; 174 double[] targetValues = null; 176 175 switch (series.Name) { 177 176 case ALL_SERIES: … … 188 187 break; 189 188 } 190 series.Points.DataBindXY(predictedValues, "", targetValues, ""); 189 if (predictedValues.Length == targetValues.Length) 190 series.Points.DataBindXY(predictedValues, "", targetValues, ""); 191 191 this.chart.Legends[series.Legend].ForeColor = Color.Black; 192 192 UpdateCursorInterval(); -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClassificationEnsembleSolutionView.cs
r6666 r7085 37 37 } 38 38 39 protected override void OnContentChanged() { 40 base.OnContentChanged(); 41 itemsListView.Items.Remove(itemsListView.FindItemWithText("Model: ClassificationEnsembleModel")); 42 } 43 39 44 #region drag & drop 40 45 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { -
branches/RegressionBenchmarks/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionEnsembleSolutionView.cs
r6666 r7085 37 37 } 38 38 39 protected override void OnContentChanged() { 40 base.OnContentChanged(); 41 itemsListView.Items.Remove(itemsListView.FindItemWithText("Model: RegressionEnsembleModel")); 42 } 43 39 44 #region drag & drop 40 45 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.