Changeset 8522 for branches/HeuristicLab.Analysis.AlgorithmBehavior
- Timestamp:
- 08/23/12 15:05:30 (12 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/LinearLeastSquaresFitting.cs
r8521 r8522 45 45 public static double CalculateError(double[] dataPoints, double a1, double a0) { 46 46 double r = 0.0; 47 double avgy = dataPoints.Average(); 48 double sstot = 0.0; 49 double sserr = 0.0; 50 47 51 for (int i = 0; i < dataPoints.Count(); i++) { 48 52 double y = a1 * i + a0; 49 r += Math.Abs(dataPoints[i] - y); 53 sstot += Math.Pow(dataPoints[i] - avgy, 2); 54 sserr += Math.Pow(dataPoints[i] - y, 2); 50 55 } 56 57 r = 1.0 - (sserr / sstot); 51 58 return r; 52 59 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/RunCollectionStatisticalTabularView.cs
r8521 r8522 156 156 string rowName = (string)dataRowComboBox.SelectedItem; 157 157 158 string[] columnNames = new string[] { "Count", "Minimum", "Maximum", "Average", "Median", "Standard Deviation", "Variance", "25th Percentile", "75th Percentile", "Gradient", " AbsolutError" };158 string[] columnNames = new string[] { "Count", "Minimum", "Maximum", "Average", "Median", "Standard Deviation", "Variance", "25th Percentile", "75th Percentile", "Gradient", "Relative Error" }; 159 159 160 160 var runs = Content.Where(x => x.Results.ContainsKey(resultName)); … … 200 200 stringConvertibleMatrixView.Content = dt; 201 201 } 202 203 private void addLineToChart_Click(object sender, EventArgs e) { 204 string resultName = (string)dataTableComboBox.SelectedItem; 205 string rowName = (string)dataRowComboBox.SelectedItem; 206 var runs = Content.Where(x => x.Results.ContainsKey(resultName)); 207 208 foreach (Run run in runs) { 209 DataTable resTable = (DataTable)run.Results[resultName]; 210 DataRow row = resTable.Rows[rowName]; 211 var values = row.Values.ToArray(); 212 double k, d; 213 LinearLeastSquaresFitting.Calculate(values, out k, out d); 214 215 DataRow newRow = new DataRow(row.Name + " Fitted Line"); 216 for (int i = 0; i < values.Count(); i++) { 217 newRow.Values.Add(k * i + d); 218 } 219 220 if (!resTable.Rows.ContainsKey(newRow.Name)) 221 resTable.Rows.Add(newRow); 222 } 223 } 202 224 } 203 225 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/RunCollectionStatisticalTabularView.designer.cs
r8502 r8522 50 50 this.label1 = new System.Windows.Forms.Label(); 51 51 this.dataTableComboBox = new System.Windows.Forms.ComboBox(); 52 this.addLineToChart = new System.Windows.Forms.Button(); 52 53 this.SuspendLayout(); 53 54 // … … 64 65 this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = true; 65 66 this.stringConvertibleMatrixView.ShowStatisticalInformation = true; 66 this.stringConvertibleMatrixView.Size = new System.Drawing.Size(492, 323);67 this.stringConvertibleMatrixView.Size = new System.Drawing.Size(492, 294); 67 68 this.stringConvertibleMatrixView.TabIndex = 0; 68 69 // … … 109 110 this.dataTableComboBox.SelectedIndexChanged += new System.EventHandler(this.dataTableComboBox_SelectedIndexChanged); 110 111 // 112 // addLineToChart 113 // 114 this.addLineToChart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 115 this.addLineToChart.Location = new System.Drawing.Point(420, 359); 116 this.addLineToChart.Name = "addLineToChart"; 117 this.addLineToChart.Size = new System.Drawing.Size(75, 23); 118 this.addLineToChart.TabIndex = 9; 119 this.addLineToChart.Text = "Fit Line"; 120 this.addLineToChart.UseVisualStyleBackColor = true; 121 this.addLineToChart.Click += new System.EventHandler(this.addLineToChart_Click); 122 // 111 123 // RunCollectionStatisticalTabularView 112 124 // 125 this.Controls.Add(this.addLineToChart); 113 126 this.Controls.Add(this.dataRowComboBox); 114 127 this.Controls.Add(this.label2); … … 129 142 private System.Windows.Forms.Label label1; 130 143 private System.Windows.Forms.ComboBox dataTableComboBox; 144 private System.Windows.Forms.Button addLineToChart; 131 145 } 132 146 }
Note: See TracChangeset
for help on using the changeset viewer.