Changeset 11670
- Timestamp:
- 12/08/14 23:31:39 (10 years ago)
- Location:
- branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.Designer.cs
r11375 r11670 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea 1= new System.Windows.Forms.DataVisualization.Charting.ChartArea();49 System.Windows.Forms.DataVisualization.Charting.Series series 1= new System.Windows.Forms.DataVisualization.Charting.Series();48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 49 System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); 50 50 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SampleSizeInfluenceView)); 51 51 this.xAxisLabel = new System.Windows.Forms.Label(); … … 55 55 this.noRunsLabel = new System.Windows.Forms.Label(); 56 56 this.splitContainer = new System.Windows.Forms.SplitContainer(); 57 this.hypergeometricCheckBox = new System.Windows.Forms.CheckBox(); 58 this.label1 = new System.Windows.Forms.Label(); 59 this.RecalculateButton = new System.Windows.Forms.Button(); 57 60 this.sampleSizeTextBox = new System.Windows.Forms.TextBox(); 58 this.xAxis ComboBox = new System.Windows.Forms.TextBox();61 this.xAxisTextBox = new System.Windows.Forms.TextBox(); 59 62 this.defineSampleSizeButton = new System.Windows.Forms.Button(); 60 63 this.showStatisticsCheckBox = new System.Windows.Forms.CheckBox(); … … 62 65 this.statisticsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 63 66 this.tooltip = new System.Windows.Forms.ToolTip(this.components); 64 this.label1 = new System.Windows.Forms.Label();65 67 ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit(); 66 68 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); … … 75 77 this.xAxisLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 76 78 this.xAxisLabel.AutoSize = true; 77 this.xAxisLabel.Location = new System.Drawing.Point( 139, 256);79 this.xAxisLabel.Location = new System.Drawing.Point(438, 277); 78 80 this.xAxisLabel.Name = "xAxisLabel"; 79 81 this.xAxisLabel.Size = new System.Drawing.Size(62, 13); … … 106 108 | System.Windows.Forms.AnchorStyles.Left) 107 109 | System.Windows.Forms.AnchorStyles.Right))); 108 chartArea 1.Name = "ChartArea1";109 this.chart.ChartAreas.Add(chartArea 1);110 chartArea2.Name = "ChartArea1"; 111 this.chart.ChartAreas.Add(chartArea2); 110 112 this.chart.Location = new System.Drawing.Point(6, 30); 111 113 this.chart.Name = "chart"; 112 series 1.ChartArea = "ChartArea1";113 series 1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.BoxPlot;114 series 1.IsVisibleInLegend = false;115 series 1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;116 series 1.Name = "DataSeries";117 series 1.YValuesPerPoint = 6;118 this.chart.Series.Add(series 1);119 this.chart.Size = new System.Drawing.Size( 534, 217);114 series2.ChartArea = "ChartArea1"; 115 series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.BoxPlot; 116 series2.IsVisibleInLegend = false; 117 series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; 118 series2.Name = "DataSeries"; 119 series2.YValuesPerPoint = 6; 120 this.chart.Series.Add(series2); 121 this.chart.Size = new System.Drawing.Size(833, 238); 120 122 this.chart.TabIndex = 17; 121 123 this.chart.Text = "chart"; … … 127 129 this.noRunsLabel.Anchor = System.Windows.Forms.AnchorStyles.None; 128 130 this.noRunsLabel.AutoSize = true; 129 this.noRunsLabel.Location = new System.Drawing.Point( 212, 122);131 this.noRunsLabel.Location = new System.Drawing.Point(361, 133); 130 132 this.noRunsLabel.Name = "noRunsLabel"; 131 133 this.noRunsLabel.Size = new System.Drawing.Size(138, 13); … … 142 144 // splitContainer.Panel1 143 145 // 146 this.splitContainer.Panel1.Controls.Add(this.hypergeometricCheckBox); 147 this.splitContainer.Panel1.Controls.Add(this.label1); 148 this.splitContainer.Panel1.Controls.Add(this.RecalculateButton); 144 149 this.splitContainer.Panel1.Controls.Add(this.sampleSizeTextBox); 145 this.splitContainer.Panel1.Controls.Add(this.xAxis ComboBox);150 this.splitContainer.Panel1.Controls.Add(this.xAxisTextBox); 146 151 this.splitContainer.Panel1.Controls.Add(this.defineSampleSizeButton); 147 152 this.splitContainer.Panel1.Controls.Add(this.showStatisticsCheckBox); … … 155 160 // 156 161 this.splitContainer.Panel2.Controls.Add(this.statisticsGroupBox); 157 this.splitContainer.Size = new System.Drawing.Size( 543, 416);158 this.splitContainer.SplitterDistance = 2 77;162 this.splitContainer.Size = new System.Drawing.Size(851, 447); 163 this.splitContainer.SplitterDistance = 297; 159 164 this.splitContainer.TabIndex = 23; 160 165 // 166 // hypergeometricCheckBox 167 // 168 this.hypergeometricCheckBox.AutoSize = true; 169 this.hypergeometricCheckBox.Location = new System.Drawing.Point(332, 7); 170 this.hypergeometricCheckBox.Name = "hypergeometricCheckBox"; 171 this.hypergeometricCheckBox.Size = new System.Drawing.Size(100, 17); 172 this.hypergeometricCheckBox.TabIndex = 28; 173 this.hypergeometricCheckBox.Text = "Hypergeometric"; 174 this.hypergeometricCheckBox.UseVisualStyleBackColor = true; 175 this.hypergeometricCheckBox.CheckedChanged += new System.EventHandler(this.hypergeometricCheckBox_CheckedChanged); 176 // 177 // label1 178 // 179 this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 180 this.label1.AutoSize = true; 181 this.label1.Location = new System.Drawing.Point(566, 6); 182 this.label1.Name = "label1"; 183 this.label1.Size = new System.Drawing.Size(143, 13); 184 this.label1.TabIndex = 26; 185 this.label1.Text = "Recommended Sample Size:"; 186 // 187 // RecalculateButton 188 // 189 this.RecalculateButton.Location = new System.Drawing.Point(251, 3); 190 this.RecalculateButton.Name = "RecalculateButton"; 191 this.RecalculateButton.Size = new System.Drawing.Size(75, 23); 192 this.RecalculateButton.TabIndex = 27; 193 this.RecalculateButton.Text = "Recalculate"; 194 this.RecalculateButton.UseVisualStyleBackColor = true; 195 this.RecalculateButton.Click += new System.EventHandler(this.RecalculateButton_Click); 196 // 161 197 // sampleSizeTextBox 162 198 // 163 this.sampleSizeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 164 | System.Windows.Forms.AnchorStyles.Right))); 165 this.sampleSizeTextBox.Location = new System.Drawing.Point(400, 3); 199 this.sampleSizeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 200 this.sampleSizeTextBox.Location = new System.Drawing.Point(724, 3); 166 201 this.sampleSizeTextBox.Name = "sampleSizeTextBox"; 167 202 this.sampleSizeTextBox.ReadOnly = true; 168 this.sampleSizeTextBox.Size = new System.Drawing.Size(1 40, 20);203 this.sampleSizeTextBox.Size = new System.Drawing.Size(124, 20); 169 204 this.sampleSizeTextBox.TabIndex = 26; 170 205 // 171 // xAxis ComboBox172 // 173 this.xAxis ComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));174 this.xAxis ComboBox.Location = new System.Drawing.Point(207, 253);175 this.xAxis ComboBox.Name = "xAxisComboBox";176 this.xAxis ComboBox.Size = new System.Drawing.Size(238, 20);177 this.xAxis ComboBox.TabIndex = 25;178 this.xAxis ComboBox.TextChanged += new System.EventHandler(this.xAxisComboBox_TextChanged);206 // xAxisTextBox 207 // 208 this.xAxisTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 209 this.xAxisTextBox.Location = new System.Drawing.Point(506, 274); 210 this.xAxisTextBox.Name = "xAxisTextBox"; 211 this.xAxisTextBox.Size = new System.Drawing.Size(238, 20); 212 this.xAxisTextBox.TabIndex = 25; 213 this.xAxisTextBox.TextChanged += new System.EventHandler(this.xAxisTextBox_TextChanged); 179 214 // 180 215 // defineSampleSizeButton 181 216 // 182 217 this.defineSampleSizeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 183 this.defineSampleSizeButton.Location = new System.Drawing.Point( 451, 252);218 this.defineSampleSizeButton.Location = new System.Drawing.Point(750, 273); 184 219 this.defineSampleSizeButton.Name = "defineSampleSizeButton"; 185 220 this.defineSampleSizeButton.Size = new System.Drawing.Size(89, 21); … … 196 231 this.showStatisticsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; 197 232 this.showStatisticsCheckBox.Image = HeuristicLab.Common.Resources.VSImageLibrary.Properties; 198 this.showStatisticsCheckBox.Location = new System.Drawing.Point(6, 2 45);233 this.showStatisticsCheckBox.Location = new System.Drawing.Point(6, 267); 199 234 this.showStatisticsCheckBox.Name = "showStatisticsCheckBox"; 200 235 this.showStatisticsCheckBox.Size = new System.Drawing.Size(24, 24); … … 212 247 this.statisticsGroupBox.Location = new System.Drawing.Point(3, 3); 213 248 this.statisticsGroupBox.Name = "statisticsGroupBox"; 214 this.statisticsGroupBox.Size = new System.Drawing.Size( 534, 129);249 this.statisticsGroupBox.Size = new System.Drawing.Size(833, 141); 215 250 this.statisticsGroupBox.TabIndex = 1; 216 251 this.statisticsGroupBox.TabStop = false; … … 227 262 this.statisticsMatrixView.ShowRowsAndColumnsTextBox = false; 228 263 this.statisticsMatrixView.ShowStatisticalInformation = false; 229 this.statisticsMatrixView.Size = new System.Drawing.Size( 528, 110);264 this.statisticsMatrixView.Size = new System.Drawing.Size(827, 122); 230 265 this.statisticsMatrixView.TabIndex = 0; 231 //232 // label1233 //234 this.label1.AutoSize = true;235 this.label1.Location = new System.Drawing.Point(251, 6);236 this.label1.Name = "label1";237 this.label1.Size = new System.Drawing.Size(143, 13);238 this.label1.TabIndex = 26;239 this.label1.Text = "Recommended Sample Size:";240 266 // 241 267 // SampleSizeInfluenceView … … 244 270 this.BackColor = System.Drawing.SystemColors.Window; 245 271 this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 246 this.Controls.Add(this.label1);247 272 this.Controls.Add(this.splitContainer); 248 273 this.Name = "SampleSizeInfluenceView"; 249 this.Size = new System.Drawing.Size( 543, 416);274 this.Size = new System.Drawing.Size(851, 447); 250 275 ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); 251 276 this.splitContainer.Panel1.ResumeLayout(false); … … 256 281 this.statisticsGroupBox.ResumeLayout(false); 257 282 this.ResumeLayout(false); 258 this.PerformLayout();259 283 260 284 } … … 273 297 protected System.Windows.Forms.CheckBox showStatisticsCheckBox; 274 298 private System.Windows.Forms.Button defineSampleSizeButton; 275 private System.Windows.Forms.TextBox xAxis ComboBox;299 private System.Windows.Forms.TextBox xAxisTextBox; 276 300 private System.Windows.Forms.Label label1; 277 301 private System.Windows.Forms.TextBox sampleSizeTextBox; 302 private System.Windows.Forms.Button RecalculateButton; 303 private System.Windows.Forms.CheckBox hypergeometricCheckBox; 278 304 } 279 305 } -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs
r11378 r11670 208 208 } 209 209 210 private void UpdateSampleSizes( ) {210 private void UpdateSampleSizes(bool forceUpdate = false) { 211 211 string selectedYAxis = (string)this.yAxisComboBox.SelectedItem; 212 212 213 if (selectedYAxis != null && xAxisComboBox.Text.Trim() == string.Empty) { 213 if (selectedYAxis != null && (xAxisTextBox.Text.Trim() == string.Empty || forceUpdate)) { 214 xAxisTextBox.Clear(); 214 215 List<double> values = new List<double>(); 215 216 foreach (IRun run in Content.Where(x => x.Visible)) { … … 221 222 222 223 if (values.Count() > 0) { 223 xAxisComboBox.Text = "1; "; 224 xAxisComboBox.Text += ((int)(values.Count() / 4)).ToString() + "; "; 225 xAxisComboBox.Text += ((int)(values.Count() / 2)).ToString() + "; "; 226 xAxisComboBox.Text += ((int)(values.Count() / 4 * 3)).ToString() + "; "; 227 xAxisComboBox.Text += ((int)(values.Count())).ToString(); 224 if (hypergeometricCheckBox.Checked) { 225 xAxisTextBox.Text += ((int)(values.Count() / 16)).ToString() + "; "; 226 xAxisTextBox.Text += ((int)(values.Count() / 8)).ToString() + "; "; 227 xAxisTextBox.Text += ((int)(values.Count() / 4)).ToString(); 228 } else { 229 xAxisTextBox.Text += ((int)(values.Count() / 4)).ToString() + "; "; 230 xAxisTextBox.Text += ((int)(values.Count() / 2)).ToString() + "; "; 231 xAxisTextBox.Text += ((int)(values.Count() / 4 * 3)).ToString() + "; "; 232 xAxisTextBox.Text += ((int)(values.Count())).ToString(); 233 } 228 234 } 229 235 } … … 232 238 private void UpdateComboBoxes() { 233 239 string selectedYAxis = (string)this.yAxisComboBox.SelectedItem; 234 this.xAxis ComboBox.Text = string.Empty;240 this.xAxisTextBox.Text = string.Empty; 235 241 this.yAxisComboBox.Items.Clear(); 236 242 if (Content != null) { … … 252 258 if (Content != null) { 253 259 var usableRuns = Content.Where(r => r.Visible).ToList(); 254 Random rand = new Random(); 255 256 List<int> groupSizes = ParseGroupSizesFromText(xAxisComboBox.Text); 257 foreach (int gs in groupSizes) { 258 int idx = gs; 259 List<IRun> runGroup = new List<IRun>(); 260 if (idx > usableRuns.Count()) { 261 idx = usableRuns.Count(); 262 } 263 264 for (int i = 0; i < idx; i++) { 265 int r = rand.Next(usableRuns.Count()); 266 runGroup.Add(usableRuns[r]); 267 } 268 runGroup.ForEach(x => AddDataPoint(x, idx)); 260 List<int> groupSizes = ParseGroupSizesFromText(xAxisTextBox.Text); 261 262 if (hypergeometricCheckBox.Checked) { 263 CalculateGroupsHypergeometric(usableRuns, groupSizes); 264 } else { 265 CalculateGroups(usableRuns, groupSizes); 269 266 } 270 267 … … 285 282 } 286 283 UpdateNoRunsVisibleLabel(); 284 } 285 286 private void CalculateGroups(List<IRun> usableRuns, List<int> groupSizes) { 287 Random rand = new Random(); 288 289 foreach (int gs in groupSizes) { 290 int idx = gs; 291 List<IRun> runGroup = new List<IRun>(); 292 if (idx > usableRuns.Count()) { 293 idx = usableRuns.Count(); 294 } 295 296 for (int i = 0; i < idx; i++) { 297 int r = rand.Next(usableRuns.Count()); 298 runGroup.Add(usableRuns[r]); 299 } 300 runGroup.ForEach(x => AddDataPoint(x, idx)); 301 } 302 } 303 304 private void CalculateGroupsHypergeometric(List<IRun> usableRuns, List<int> groupSizes) { 305 Random rand = new Random(); 306 var runs = new List<IRun>(usableRuns); 307 308 foreach (int gs in groupSizes) { 309 int idx = gs; 310 List<IRun> runGroup = new List<IRun>(); 311 if (idx > runs.Count()) { 312 idx = runs.Count(); 313 } 314 315 for (int i = 0; i < idx; i++) { 316 int r = rand.Next(runs.Count()); 317 runGroup.Add(runs[r]); 318 runs.Remove(runs[r]); 319 } 320 runGroup.ForEach(x => AddDataPoint(x, idx)); 321 } 287 322 } 288 323 … … 333 368 if (datapoint != null) { 334 369 IRun run = (IRun)datapoint.Tag; 335 string selectedAxis = xAxis ComboBox.Text;370 string selectedAxis = xAxisTextBox.Text; 336 371 IItem value = null; 337 372 … … 482 517 splitContainer.Panel2Collapsed = true; 483 518 } 519 } 520 521 private void RecalculateButton_Click(object sender, EventArgs e) { 522 UpdateDataPoints(); 523 } 524 525 private void hypergeometricCheckBox_CheckedChanged(object sender, EventArgs e) { 526 UpdateSampleSizes(true); 527 UpdateDataPoints(); 484 528 } 485 529 … … 569 613 private void defineSampleSizeButton_Click(object sender, EventArgs e) { 570 614 int min = 0, max = 0, step = 1; 571 var groupSizes = ParseGroupSizesFromText(xAxis ComboBox.Text);615 var groupSizes = ParseGroupSizesFromText(xAxisTextBox.Text); 572 616 if (groupSizes.Count() > 0) { 573 617 min = groupSizes.Min(); … … 582 626 newVals += v + "; "; 583 627 } 584 xAxis ComboBox.Text = newVals;585 } 586 } 587 } 588 589 private void xAxis ComboBox_TextChanged(object sender, EventArgs e) {590 var result = ParseGroupSizesFromText(xAxis ComboBox.Text, false);628 xAxisTextBox.Text = newVals; 629 } 630 } 631 } 632 633 private void xAxisTextBox_TextChanged(object sender, EventArgs e) { 634 var result = ParseGroupSizesFromText(xAxisTextBox.Text, false); 591 635 592 636 if (seriesCache.Count() == result.Count()) {
Note: See TracChangeset
for help on using the changeset viewer.