Changeset 9706
- Timestamp:
- 07/15/13 16:33:13 (11 years ago)
- Location:
- branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs
r9378 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 29 29 using HeuristicLab.MainForm; 30 30 using HeuristicLab.Optimization; 31 using HeuristicLab.PluginInfrastructure; 31 32 32 33 namespace HeuristicLab.Analysis.Statistics { … … 49 50 InitializeComponent(); 50 51 stringConvertibleMatrixView.DataGridView.RowHeaderMouseDoubleClick += new DataGridViewCellMouseEventHandler(DataGridView_RowHeaderMouseDoubleClick); 52 53 var fittingAlgs = ApplicationManager.Manager.GetInstances<IFitting>(); 54 foreach (var fit in fittingAlgs) { 55 fittingComboBox.Items.Add(fit); 56 } 57 fittingComboBox.SelectedIndex = 0; 51 58 } 52 59 … … 137 144 DataRow row = resTable.Rows[rowName]; 138 145 var values = row.Values.ToArray(); 139 double k, d; 140 LinearLeastSquaresFitting.Calculate(values, out k, out d); 141 142 DataRow newRow = new DataRow(row.Name + " Fitted Line"); 143 for (int i = 0; i < values.Count(); i++) { 144 newRow.Values.Add(k * i + d); 145 } 146 147 var fittingAlg = fittingComboBox.SelectedItem as IFitting; 148 DataRow newRow = fittingAlg.CalculateFittedLine(values, row.Name + " (" + fittingAlg.ToString() + ")"); 146 149 147 150 if (!resTable.Rows.ContainsKey(newRow.Name)) … … 224 227 double percentile75 = values.Percentile(0.75); 225 228 double k, d, r; 226 LinearLeastSquaresFitting.Calculate(values.ToArray(), out k, out d); 227 r = LinearLeastSquaresFitting.CalculateError(values.ToArray(), k, d); 229 LinearLeastSquaresFitting llsf = new LinearLeastSquaresFitting(); 230 llsf.Calculate(values.ToArray(), out k, out d); 231 r = llsf.CalculateError(values.ToArray(), k, d); 228 232 double lowerAvg = values.OrderBy(x => x).Take((int)(values.Count() * 0.25)).Average(); 229 233 double upperAvg = values.OrderByDescending(x => x).Take((int)(values.Count() * 0.25)).Average(); -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.designer.cs
r9377 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 34 34 /// </summary> 35 35 private void InitializeComponent() { 36 this.stringConvertibleMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 36 this.fittingComboBox = new System.Windows.Forms.ComboBox(); 37 this.addValuesButton = new System.Windows.Forms.Button(); 38 this.addLineToChart = new System.Windows.Forms.Button(); 37 39 this.dataRowComboBox = new System.Windows.Forms.ComboBox(); 38 40 this.label2 = new System.Windows.Forms.Label(); 39 41 this.label1 = new System.Windows.Forms.Label(); 40 42 this.dataTableComboBox = new System.Windows.Forms.ComboBox(); 41 this.addLineToChart = new System.Windows.Forms.Button(); 42 this.addValuesButton = new System.Windows.Forms.Button(); 43 this.stringConvertibleMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 43 44 this.SuspendLayout(); 44 45 // 45 // stringConvertibleMatrixView46 // fittingComboBox 46 47 // 47 this.stringConvertibleMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 48 | System.Windows.Forms.AnchorStyles.Left) 49 | System.Windows.Forms.AnchorStyles.Right))); 50 this.stringConvertibleMatrixView.Caption = "StringConvertibleMatrix View"; 51 this.stringConvertibleMatrixView.Content = null; 52 this.stringConvertibleMatrixView.Location = new System.Drawing.Point(3, 59); 53 this.stringConvertibleMatrixView.Name = "stringConvertibleMatrixView"; 54 this.stringConvertibleMatrixView.ReadOnly = true; 55 this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = true; 56 this.stringConvertibleMatrixView.ShowStatisticalInformation = true; 57 this.stringConvertibleMatrixView.Size = new System.Drawing.Size(492, 294); 58 this.stringConvertibleMatrixView.TabIndex = 0; 48 this.fittingComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 49 this.fittingComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 50 this.fittingComboBox.FormattingEnabled = true; 51 this.fittingComboBox.Location = new System.Drawing.Point(147, 359); 52 this.fittingComboBox.Name = "fittingComboBox"; 53 this.fittingComboBox.Size = new System.Drawing.Size(200, 21); 54 this.fittingComboBox.TabIndex = 12; 55 // 56 // addValuesButton 57 // 58 this.addValuesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 59 this.addValuesButton.Location = new System.Drawing.Point(8, 359); 60 this.addValuesButton.Name = "addValuesButton"; 61 this.addValuesButton.Size = new System.Drawing.Size(133, 23); 62 this.addValuesButton.TabIndex = 10; 63 this.addValuesButton.Text = "Add Values to Results"; 64 this.addValuesButton.UseVisualStyleBackColor = true; 65 this.addValuesButton.Click += new System.EventHandler(this.addValuesButton_Click); 66 // 67 // addLineToChart 68 // 69 this.addLineToChart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 70 this.addLineToChart.Location = new System.Drawing.Point(353, 359); 71 this.addLineToChart.Name = "addLineToChart"; 72 this.addLineToChart.Size = new System.Drawing.Size(133, 23); 73 this.addLineToChart.TabIndex = 9; 74 this.addLineToChart.Text = "Fit Line to Chart"; 75 this.addLineToChart.UseVisualStyleBackColor = true; 76 this.addLineToChart.Click += new System.EventHandler(this.addLineToChart_Click); 59 77 // 60 78 // dataRowComboBox … … 100 118 this.dataTableComboBox.SelectedIndexChanged += new System.EventHandler(this.dataTableComboBox_SelectedIndexChanged); 101 119 // 102 // addLineToChart120 // stringConvertibleMatrixView 103 121 // 104 this.addLineToChart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 105 this.addLineToChart.Location = new System.Drawing.Point(353, 359); 106 this.addLineToChart.Name = "addLineToChart"; 107 this.addLineToChart.Size = new System.Drawing.Size(133, 23); 108 this.addLineToChart.TabIndex = 9; 109 this.addLineToChart.Text = "Fit Line to Chart"; 110 this.addLineToChart.UseVisualStyleBackColor = true; 111 this.addLineToChart.Click += new System.EventHandler(this.addLineToChart_Click); 112 // 113 // addValuesButton 114 // 115 this.addValuesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 116 this.addValuesButton.Location = new System.Drawing.Point(214, 359); 117 this.addValuesButton.Name = "addValuesButton"; 118 this.addValuesButton.Size = new System.Drawing.Size(133, 23); 119 this.addValuesButton.TabIndex = 10; 120 this.addValuesButton.Text = "Add Values to Results"; 121 this.addValuesButton.UseVisualStyleBackColor = true; 122 this.addValuesButton.Click += new System.EventHandler(this.addValuesButton_Click); 122 this.stringConvertibleMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 123 | System.Windows.Forms.AnchorStyles.Left) 124 | System.Windows.Forms.AnchorStyles.Right))); 125 this.stringConvertibleMatrixView.Caption = "StringConvertibleMatrix View"; 126 this.stringConvertibleMatrixView.Content = null; 127 this.stringConvertibleMatrixView.Location = new System.Drawing.Point(3, 59); 128 this.stringConvertibleMatrixView.Name = "stringConvertibleMatrixView"; 129 this.stringConvertibleMatrixView.ReadOnly = true; 130 this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = true; 131 this.stringConvertibleMatrixView.ShowStatisticalInformation = true; 132 this.stringConvertibleMatrixView.Size = new System.Drawing.Size(492, 294); 133 this.stringConvertibleMatrixView.TabIndex = 0; 123 134 // 124 135 // ChartAnalysisView 125 136 // 137 this.Controls.Add(this.fittingComboBox); 126 138 this.Controls.Add(this.addValuesButton); 127 139 this.Controls.Add(this.addLineToChart); … … 146 158 private System.Windows.Forms.Button addLineToChart; 147 159 private System.Windows.Forms.Button addValuesButton; 160 private System.Windows.Forms.ComboBox fittingComboBox; 148 161 } 149 162 } -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.cs
r9398 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.designer.cs
r9383 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/HeuristicLab.Analysis.Statistics-3.3.csproj
r9389 r9706 114 114 </ItemGroup> 115 115 <ItemGroup> 116 <Compile Include="ExpFitting.cs" /> 117 <Compile Include="IFitting.cs" /> 116 118 <Compile Include="LinearLeastSquaresFitting.cs" /> 119 <Compile Include="LogFitting.cs" /> 117 120 <Compile Include="Resources.Designer.cs"> 118 121 <AutoGen>True</AutoGen> -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/KruskalWallis.cs
r9353 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/LinearLeastSquaresFitting.cs
r9353 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 25 25 namespace HeuristicLab.Analysis.Statistics { 26 public class LinearLeastSquaresFitting { 27 public static void Calculate(double[] dataPoints, out double a1, out double a0) { 26 public class LinearLeastSquaresFitting : IFitting { 27 public void Calculate(double[] dataPoints, out double p0, out double p1) { 28 var stdX = Enumerable.Range(0, dataPoints.Count()).Select(x => (double)x).ToArray(); 29 Calculate(dataPoints, stdX, out p0, out p1); 30 } 31 32 public void Calculate(double[] y, double[] x, out double p0, out double p1) { 33 if (y.Count() != x.Count()) { 34 throw new ArgumentException("The lenght of x and y needs do be equal. "); 35 } 36 28 37 double sxy = 0.0; 29 38 double sxx = 0.0; 30 int n = dataPoints.Count();31 double sy = dataPoints.Sum();39 int n = y.Count(); 40 double sy = y.Sum(); 32 41 double sx = ((n - 1) * n) / 2; 33 42 double avgy = sy / n; … … 35 44 36 45 for (int i = 0; i < n; i++) { 37 sxy += i * dataPoints[i];38 sxx += i * i;46 sxy += x[i] * y[i]; 47 sxx += x[i] * x[i]; 39 48 } 40 49 41 a1= (sxy - (n * avgx * avgy)) / (sxx - (n * avgx * avgx));42 a0 = avgy - a1* avgx;50 p0 = (sxy - (n * avgx * avgy)) / (sxx - (n * avgx * avgx)); 51 p1 = avgy - p0 * avgx; 43 52 } 44 53 45 public static double CalculateError(double[] dataPoints, double a1, double a0) { 54 //TODO: adapt or remove 55 public double CalculateError(double[] dataPoints, double a1, double a0) { 46 56 double r = 0.0; 47 57 double avgy = dataPoints.Average(); … … 58 68 return r; 59 69 } 70 71 public DataRow CalculateFittedLine(double[] y, double[] x, string rowName) { 72 double k, d; 73 Calculate(y, x, out k, out d); 74 75 DataRow newRow = new DataRow(rowName); 76 for (int i = 0; i < x.Count(); i++) { 77 newRow.Values.Add(k * x[i] + d); 78 } 79 return newRow; 80 } 81 82 public DataRow CalculateFittedLine(double[] dataPoints, string rowName) { 83 DataRow newRow = new DataRow(rowName); 84 double c0, c1; 85 Calculate(dataPoints, out c0, out c1); 86 var stdX = Enumerable.Range(0, dataPoints.Count()).Select(x => (double)x).ToArray(); 87 88 for (int i = 0; i < stdX.Count(); i++) { 89 newRow.Values.Add(c0 * stdX[i] + c1); 90 } 91 92 return newRow; 93 } 94 95 public override string ToString() { 96 return "Linear Fitting"; 97 } 60 98 } 61 99 } -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/Plugin.cs.frame
r9355 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/Properties/AssemblyInfo.cs.frame
r9353 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 32 32 [assembly: AssemblyCompany("")] 33 33 [assembly: AssemblyProduct("HeuristicLab")] 34 [assembly: AssemblyCopyright("(c) 2002-201 2HEAL")]34 [assembly: AssemblyCopyright("(c) 2002-2013 HEAL")] 35 35 [assembly: AssemblyTrademark("")] 36 36 [assembly: AssemblyCulture("")] -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeChecker.cs
r9353 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeChecker.designer.cs
r9353 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs
r9353 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.Designer.cs
r9355 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs
r9355 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs
r9389 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.designer.cs
r9389 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/TTest.cs
r9353 r9706 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab.
Note: See TracChangeset
for help on using the changeset viewer.