Changeset 11697
- Timestamp:
- 12/18/14 16:55:53 (10 years ago)
- Location:
- branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs
r11665 r11697 56 56 InitializeComponent(); 57 57 58 stringConvertibleMatrixView.DataGridView.RowHeaderMouseDoubleClick += new DataGridViewCellMouseEventHandler(DataGridView_RowHeaderMouseDoubleClick);58 stringConvertibleMatrixView.DataGridView.RowHeaderMouseDoubleClick += DataGridView_RowHeaderMouseDoubleClick; 59 59 60 60 var fittingAlgs = ApplicationManager.Manager.GetInstances<IFitting>(); … … 67 67 protected override void Dispose(bool disposing) { 68 68 if (disposing && (components != null)) { 69 stringConvertibleMatrixView.DataGridView.RowHeaderMouseDoubleClick -= new DataGridViewCellMouseEventHandler(DataGridView_RowHeaderMouseDoubleClick);69 stringConvertibleMatrixView.DataGridView.RowHeaderMouseDoubleClick -= DataGridView_RowHeaderMouseDoubleClick; 70 70 components.Dispose(); 71 71 } … … 93 93 protected override void RegisterContentEvents() { 94 94 base.RegisterContentEvents(); 95 Content. ItemsAdded += Content_ItemsAdded;96 Content. ItemsRemoved += Content_ItemsRemoved;95 Content.ColumnsChanged += Content_ColumnsChanged; 96 Content.RowsChanged += Content_RowsChanged; 97 97 Content.CollectionReset += Content_CollectionReset; 98 98 Content.UpdateOfRunsInProgressChanged += Content_UpdateOfRunsInProgressChanged; 99 RegisterRunEvents(Content);100 99 } 101 100 102 101 protected override void DeregisterContentEvents() { 103 102 base.DeregisterContentEvents(); 104 Content. ItemsAdded -= Content_ItemsAdded;105 Content. ItemsRemoved -= Content_ItemsRemoved;103 Content.ColumnsChanged -= Content_ColumnsChanged; 104 Content.RowsChanged -= Content_RowsChanged; 106 105 Content.CollectionReset -= Content_CollectionReset; 107 106 Content.UpdateOfRunsInProgressChanged -= Content_UpdateOfRunsInProgressChanged; 108 DeregisterRunEvents(Content); 109 } 110 111 private void RegisterRunEvents(IEnumerable<IRun> runs) { 112 foreach (IRun run in runs) { 113 RegisterRunResultsEvents(run); 114 } 115 } 116 117 private void DeregisterRunEvents(IEnumerable<IRun> runs) { 118 foreach (IRun run in runs) { 119 DeregisterRunResultsEvents(run); 120 } 121 } 122 123 private void RegisterRunResultsEvents(IRun run) { 124 IObservableDictionary<string, IItem> dict = run.Results; 125 dict.ItemsAdded += run_Changed; 126 dict.ItemsRemoved += run_Changed; 127 dict.ItemsReplaced += run_Changed; 128 dict.CollectionReset += run_Changed; 129 } 130 131 private void DeregisterRunResultsEvents(IRun run) { 132 IObservableDictionary<string, IItem> dict = run.Results; 133 dict.ItemsAdded -= run_Changed; 134 dict.ItemsRemoved -= run_Changed; 135 dict.ItemsReplaced -= run_Changed; 136 dict.CollectionReset -= run_Changed; 107 } 108 109 void Content_RowsChanged(object sender, EventArgs e) { 110 RebuildDataTableAsync(); 111 } 112 113 void Content_ColumnsChanged(object sender, EventArgs e) { 114 RebuildDataTableAsync(); 137 115 } 138 116 139 117 private void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) { 140 DeregisterRunEvents(e.OldItems);141 RegisterRunEvents(e.Items);142 118 UpdateComboboxes(); 143 119 RebuildDataTableAsync(); 144 120 } 145 121 146 private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {147 DeregisterRunEvents(e.Items);148 RebuildDataTableAsync();149 }150 151 private void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {152 RegisterRunEvents(e.Items);153 RebuildDataTableAsync();154 }155 156 122 private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) { 157 123 suppressUpdates = Content.UpdateOfRunsInProgress; … … 164 130 } 165 131 } 166 167 private void run_Changed(object sender, EventArgs e) {168 if (InvokeRequired)169 Invoke(new EventHandler(run_Changed), sender, e);170 else if (!suppressUpdates) {171 UpdateComboboxes();172 }173 }174 132 #endregion 175 133 176 #region Events134 #region events 177 135 private void DataGridView_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { 178 136 if (e.RowIndex >= 0) { … … 219 177 220 178 var fittingAlg = fittingComboBox.SelectedItem as IFitting; 221 DataRow newRow = fittingAlg.CalculateFittedLine(values, row.Name + " (" + fittingAlg .ToString()+ ")");179 DataRow newRow = fittingAlg.CalculateFittedLine(values, row.Name + " (" + fittingAlg + ")"); 222 180 223 181 if (!resTable.Rows.ContainsKey(newRow.Name)) … … 239 197 string newResultName = resultName + " " + rowName + " " + sm.ColumnNames.ElementAt(j); 240 198 if (!run.Results.ContainsKey(newResultName)) { 241 run.Results.Add(new KeyValuePair<string, Core.IItem>(newResultName, new DoubleValue(sm[i, j])));199 run.Results.Add(new KeyValuePair<string, IItem>(newResultName, new DoubleValue(sm[i, j]))); 242 200 } 243 201 } … … 306 264 private void RebuildDataTable(string resultName, string rowName) { 307 265 LinearLeastSquaresFitting llsFitting = new LinearLeastSquaresFitting(); 308 LogFitting logFitting = new LogFitting();309 266 string[] columnNames = new string[] { "Count", "Minimum", "Maximum", "Average", "Median", "Standard Deviation", "Variance", "25th Percentile", "75th Percentile", 310 267 "Avg. of Upper 25 %", " Avg. of Lower 25 %", "Avg. of First 25 %", "Avg. of Last 25 %", "Linear Gradient", "Average Relative Error" }; -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.cs
r11644 r11697 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Collections;26 using HeuristicLab.Core;27 25 using HeuristicLab.Core.Views; 28 26 using HeuristicLab.Data; … … 80 78 protected override void RegisterContentEvents() { 81 79 base.RegisterContentEvents(); 82 Content. ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);83 Content. ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);80 Content.ColumnsChanged += Content_ColumnsChanged; 81 Content.RowsChanged += Content_RowsChanged; 84 82 Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 85 83 Content.UpdateOfRunsInProgressChanged += Content_UpdateOfRunsInProgressChanged; 86 RegisterRunEvents(Content);87 84 } 88 85 89 86 protected override void DeregisterContentEvents() { 90 87 base.DeregisterContentEvents(); 91 Content. ItemsAdded -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);92 Content. ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);88 Content.ColumnsChanged -= Content_ColumnsChanged; 89 Content.RowsChanged -= Content_RowsChanged; 93 90 Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset); 94 91 Content.UpdateOfRunsInProgressChanged -= Content_UpdateOfRunsInProgressChanged; 95 DeregisterRunEvents(Content); 96 } 97 98 private void RegisterRunEvents(IEnumerable<IRun> runs) { 99 foreach (IRun run in runs) { 100 RegisterRunResultsEvents(run); 101 RegisterRunParametersEvents(run); 102 run.PropertyChanged += run_PropertyChanged; 103 } 104 } 105 106 private void DeregisterRunEvents(IEnumerable<IRun> runs) { 107 foreach (IRun run in runs) { 108 DeregisterRunResultsEvents(run); 109 DeregisterRunParametersEvents(run); 110 run.PropertyChanged -= run_PropertyChanged; 111 } 112 } 113 114 private void RegisterRunResultsEvents(IRun run) { 115 IObservableDictionary<string, IItem> dict = run.Results; 116 dict.ItemsAdded += run_Changed; 117 dict.ItemsRemoved += run_Changed; 118 dict.ItemsReplaced += run_Changed; 119 dict.CollectionReset += run_Changed; 120 } 121 122 private void DeregisterRunResultsEvents(IRun run) { 123 IObservableDictionary<string, IItem> dict = run.Results; 124 dict.ItemsAdded -= run_Changed; 125 dict.ItemsRemoved -= run_Changed; 126 dict.ItemsReplaced -= run_Changed; 127 dict.CollectionReset -= run_Changed; 128 } 129 130 private void RegisterRunParametersEvents(IRun run) { 131 IObservableDictionary<string, IItem> dict = run.Parameters; 132 dict.ItemsAdded += run_Changed; 133 dict.ItemsRemoved += run_Changed; 134 dict.ItemsReplaced += run_Changed; 135 dict.CollectionReset += run_Changed; 136 } 137 138 private void DeregisterRunParametersEvents(IRun run) { 139 IObservableDictionary<string, IItem> dict = run.Parameters; 140 dict.ItemsAdded -= run_Changed; 141 dict.ItemsRemoved -= run_Changed; 142 dict.ItemsReplaced -= run_Changed; 143 dict.CollectionReset -= run_Changed; 92 } 93 94 void Content_RowsChanged(object sender, EventArgs e) { 95 UpdateUI(); 96 } 97 98 void Content_ColumnsChanged(object sender, EventArgs e) { 99 UpdateUI(); 144 100 } 145 101 146 102 private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) { 147 DeregisterRunEvents(e.OldItems);148 RegisterRunEvents(e.Items);149 UpdateUI();150 }151 152 private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {153 DeregisterRunEvents(e.Items);154 UpdateUI();155 }156 157 private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {158 RegisterRunEvents(e.Items);159 103 UpdateUI(); 160 104 } … … 162 106 private void Content_UpdateOfRunsInProgressChanged(object sender, EventArgs e) { 163 107 suppressUpdates = Content.UpdateOfRunsInProgress; 164 UpdateUI();165 }166 167 private void run_Changed(object sender, EventArgs e) {168 if (InvokeRequired) {169 Invoke(new EventHandler(run_Changed), sender, e);170 }171 UpdateUI();172 }173 174 void run_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) {175 108 UpdateUI(); 176 109 } -
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs
r11671 r11697 41 41 private const string BoxPlotSeriesName = "BoxPlotSeries"; 42 42 private const string BoxPlotChartAreaName = "BoxPlotChartArea"; 43 private const string delimitor = ";"; 43 44 44 45 private bool suppressUpdates = false; … … 221 222 } 222 223 223 if (values. Count() > 0) {224 if (values.Any()) { 224 225 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();226 xAxisTextBox.Text += ((int)(values.Count() / 16)) + delimitor + " "; 227 xAxisTextBox.Text += ((int)(values.Count() / 8)) + delimitor + " "; 228 xAxisTextBox.Text += (int)(values.Count() / 4); 228 229 } 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();230 xAxisTextBox.Text += ((int)(values.Count() / 4)) + delimitor + " "; 231 xAxisTextBox.Text += ((int)(values.Count() / 2)) + delimitor + " "; 232 xAxisTextBox.Text += ((int)(values.Count() / 4 * 3)) + delimitor + " "; 233 xAxisTextBox.Text += (int)(values.Count()); 233 234 } 234 235 } … … 332 333 if (yValue.Any(x => !x.HasValue)) return; 333 334 334 double y= SampleSizeDetermination.DetermineSampleSizeByEstimatingMeanForLargeSampleSizes(yValue.Select(x => x.Value).ToArray());335 sampleSizeTextBox.Text = y.ToString();335 double estimatedSampleSize = SampleSizeDetermination.DetermineSampleSizeByEstimatingMeanForLargeSampleSizes(yValue.Select(x => x.Value).ToArray()); 336 sampleSizeTextBox.Text = estimatedSampleSize.ToString(); 336 337 } 337 338 338 339 private List<int> ParseGroupSizesFromText(string groupsText, bool verbose = true) { 339 const string delimitor = ";"; 340 string[] gs = groupsText.Split(delimitor.ToString().ToCharArray()); 340 string[] gs = groupsText.Split(delimitor.ToCharArray()); 341 341 List<int> vals = new List<int>(); 342 342 … … 352 352 catch (Exception ex) { 353 353 if (verbose) { 354 ErrorHandling.ShowErrorDialog("Can't parse group sizes. Please only use numbers seperated by a semicolon. ", ex);354 ErrorHandling.ShowErrorDialog("Can't parse group sizes. Please only use numbers seperated by a " + delimitor + ". ", ex); 355 355 } 356 356 } … … 481 481 this.categoricalMapping[dimension] = new Dictionary<object, double>(); 482 482 var orderedCategories = Content.Where(r => r.Visible && Content.GetValue(r, dimension) != null).Select(r => Content.GetValue(r, dimension).ToString()) 483 484 .Distinct().OrderBy(x => x, new NaturalStringComparer()); 483 .Distinct().OrderBy(x => x, new NaturalStringComparer()); 485 484 int count = 1; 486 485 foreach (var category in orderedCategories) { … … 624 623 string newVals = ""; 625 624 foreach (int v in values) { 626 newVals += v + ";";625 newVals += v + delimitor + " "; 627 626 } 628 627 xAxisTextBox.Text = newVals;
Note: See TracChangeset
for help on using the changeset viewer.