Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9937


Ignore:
Timestamp:
09/05/13 13:28:34 (11 years ago)
Author:
ascheibe
Message:

#2031

  • added an histogram to the StatisticalTestingView
  • don't allow group sizes smaller than 6
Location:
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/HeuristicLab.Analysis.Statistics-3.3.csproj

    r9917 r9937  
    4747    </Reference>
    4848    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     49      <Private>False</Private>
     50    </Reference>
     51    <Reference Include="HeuristicLab.Analysis.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     52      <SpecificVersion>False</SpecificVersion>
     53      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis.Views-3.3.dll</HintPath>
    4954      <Private>False</Private>
    5055    </Reference>
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs

    r9936 r9937  
    2525using System.Threading.Tasks;
    2626using System.Windows.Forms;
     27using HeuristicLab.Collections;
    2728using HeuristicLab.Core.Views;
    2829using HeuristicLab.Data;
     
    7071    protected override void RegisterContentEvents() {
    7172      base.RegisterContentEvents();
    72       Content.ItemsAdded += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);
    73       Content.ItemsRemoved += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    74       Content.CollectionReset += new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     73      Content.ItemsAdded += new CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);
     74      Content.ItemsRemoved += new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
     75      Content.CollectionReset += new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    7576      Content.UpdateOfRunsInProgressChanged += Content_UpdateOfRunsInProgressChanged;
    7677    }
     
    7879    protected override void DeregisterContentEvents() {
    7980      base.DeregisterContentEvents();
    80       Content.ItemsAdded -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);
    81       Content.ItemsRemoved -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
    82       Content.CollectionReset -= new HeuristicLab.Collections.CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
     81      Content.ItemsAdded -= new CollectionItemsChangedEventHandler<IRun>(Content_ItemsAdded);
     82      Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(Content_ItemsRemoved);
     83      Content.CollectionReset -= new CollectionItemsChangedEventHandler<IRun>(Content_CollectionReset);
    8384      Content.UpdateOfRunsInProgressChanged -= Content_UpdateOfRunsInProgressChanged;
    8485    }
    8586
    86     private void Content_CollectionReset(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     87    private void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    8788      RebuildDataTable();
    8889    }
    8990
    90     private void Content_ItemsRemoved(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     91    private void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    9192      RebuildDataTable();
    9293    }
    9394
    94     private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     95    private void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) {
    9596      RebuildDataTable();
    9697    }
     
    186187        DoubleMatrix dt = new DoubleMatrix(groups.Select(x => x.Count()).Max(), columnNames.Count());
    187188        dt.ColumnNames = columnNames;
    188 
    189         int i = 0;
    190         int j = 0;
    191         foreach (string columnName in columnNames) {
    192           j = 0;
     189        DataTable histogramDataTable = new DataTable(resultName);
     190
     191        for (int i = 0; i < columnNames.Count(); i++) {
     192          int j = 0;
    193193          data[i] = new double[groups[i].Count()];
     194          DataRow row = new DataRow(columnNames[i]);
     195          row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
     196          histogramDataTable.Rows.Add(row);
     197
    194198          foreach (IRun run in groups[i]) {
    195199            dt[j, i] = (double)((dynamic)run.Results[resultName]).Value;
    196200            data[i][j] = dt[j, i];
     201            row.Values.Add(dt[j, i]);
    197202            j++;
    198203          }
    199           i++;
    200         }
    201 
     204        }
     205
     206        dataTableView.Content = histogramDataTable;
    202207        stringConvertibleMatrixView.Content = dt;
    203208      }
     
    237242    }
    238243
     244    private bool VerifyDataLength(bool showMessage) {
     245      if (data == null || data.Length == 0)
     246        return false;
     247
     248      //alglib needs at least 5 samples for computation
     249      if (data.Any(x => x.Length <= 5)) {
     250        if (showMessage)
     251          MessageBox.Show(this, "You need to choose samples with a size greater 5.", "HeuristicLab", MessageBoxButtons.OK,
     252            MessageBoxIcon.Error);
     253        return false;
     254      }
     255      return true;
     256    }
     257
    239258    private void CalculateValues() {
     259      if (!VerifyDataLength(true))
     260        return;
     261
    240262      if (data != null) {
    241263        MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>()
     
    258280
    259281    private void CalculatePairwise(string groupName) {
     282      if (!VerifyDataLength(false))
     283        return;
     284
    260285      MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, "Calculating...");
    261286      Task.Factory.StartNew(() => CalculatePairwiseAsync(groupName));
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.designer.cs

    r9936 r9937  
    7171      this.normalityLabel = new System.Windows.Forms.Label();
    7272      this.selectDataGroupBox = new System.Windows.Forms.GroupBox();
     73      this.tabControl = new System.Windows.Forms.TabControl();
     74      this.tabPage1 = new System.Windows.Forms.TabPage();
     75      this.tabPage2 = new System.Windows.Forms.TabPage();
     76      this.dataTableView = new HeuristicLab.Analysis.Views.DataTableView();
    7377      this.contextMenuStrip1.SuspendLayout();
    7478      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     
    8488      this.normalityGroupBox.SuspendLayout();
    8589      this.selectDataGroupBox.SuspendLayout();
     90      this.tabControl.SuspendLayout();
     91      this.tabPage1.SuspendLayout();
     92      this.tabPage2.SuspendLayout();
    8693      this.SuspendLayout();
    8794      //
     
    99106      this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = false;
    100107      this.stringConvertibleMatrixView.ShowStatisticalInformation = true;
    101       this.stringConvertibleMatrixView.Size = new System.Drawing.Size(674, 534);
     108      this.stringConvertibleMatrixView.Size = new System.Drawing.Size(567, 523);
    102109      this.stringConvertibleMatrixView.TabIndex = 0;
    103110      //
     
    145152      this.resultComboBox.Location = new System.Drawing.Point(62, 3);
    146153      this.resultComboBox.Name = "resultComboBox";
    147       this.resultComboBox.Size = new System.Drawing.Size(311, 21);
     154      this.resultComboBox.Size = new System.Drawing.Size(250, 21);
    148155      this.resultComboBox.TabIndex = 5;
    149156      this.resultComboBox.SelectedValueChanged += new System.EventHandler(this.resultComboBox_SelectedValueChanged);
     
    168175      this.pValTextBox.Name = "pValTextBox";
    169176      this.pValTextBox.ReadOnly = true;
    170       this.pValTextBox.Size = new System.Drawing.Size(302, 20);
     177      this.pValTextBox.Size = new System.Drawing.Size(241, 20);
    171178      this.pValTextBox.TabIndex = 13;
    172179      //
     
    180187      this.groupComboBox.Location = new System.Drawing.Point(62, 3);
    181188      this.groupComboBox.Name = "groupComboBox";
    182       this.groupComboBox.Size = new System.Drawing.Size(311, 21);
     189      this.groupComboBox.Size = new System.Drawing.Size(250, 21);
    183190      this.groupComboBox.TabIndex = 14;
    184191      this.groupComboBox.SelectedValueChanged += new System.EventHandler(this.groupComboBox_SelectedValueChanged);
     
    202209      this.splitContainer1.Panel2.Controls.Add(this.groupByLabel);
    203210      this.splitContainer1.Panel2.Controls.Add(this.groupComboBox);
    204       this.splitContainer1.Size = new System.Drawing.Size(376, 54);
     211      this.splitContainer1.Size = new System.Drawing.Size(315, 54);
    205212      this.splitContainer1.SplitterDistance = 25;
    206213      this.splitContainer1.TabIndex = 18;
     
    211218            | System.Windows.Forms.AnchorStyles.Left)
    212219            | System.Windows.Forms.AnchorStyles.Right)));
    213       this.splitContainer3.Location = new System.Drawing.Point(8, 3);
     220      this.splitContainer3.Location = new System.Drawing.Point(6, 6);
    214221      this.splitContainer3.Name = "splitContainer3";
    215222      //
     
    224231      this.splitContainer3.Panel2.Controls.Add(this.normalityGroupBox);
    225232      this.splitContainer3.Panel2.Controls.Add(this.selectDataGroupBox);
    226       this.splitContainer3.Size = new System.Drawing.Size(1078, 540);
    227       this.splitContainer3.SplitterDistance = 680;
     233      this.splitContainer3.Size = new System.Drawing.Size(910, 529);
     234      this.splitContainer3.SplitterDistance = 573;
    228235      this.splitContainer3.TabIndex = 20;
    229236      //
     
    242249      this.pairwiseTestGroupBox.Location = new System.Drawing.Point(3, 289);
    243250      this.pairwiseTestGroupBox.Name = "pairwiseTestGroupBox";
    244       this.pairwiseTestGroupBox.Size = new System.Drawing.Size(388, 229);
     251      this.pairwiseTestGroupBox.Size = new System.Drawing.Size(327, 218);
    245252      this.pairwiseTestGroupBox.TabIndex = 22;
    246253      this.pairwiseTestGroupBox.TabStop = false;
     
    260267      this.pairwiseStringConvertibleMatrixView.ShowRowsAndColumnsTextBox = false;
    261268      this.pairwiseStringConvertibleMatrixView.ShowStatisticalInformation = false;
    262       this.pairwiseStringConvertibleMatrixView.Size = new System.Drawing.Size(376, 151);
     269      this.pairwiseStringConvertibleMatrixView.Size = new System.Drawing.Size(315, 140);
    263270      this.pairwiseStringConvertibleMatrixView.TabIndex = 19;
    264271      //
     
    267274      this.pairwiseLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    268275      this.pairwiseLabel.AutoSize = true;
    269       this.pairwiseLabel.Location = new System.Drawing.Point(366, 47);
     276      this.pairwiseLabel.Location = new System.Drawing.Point(305, 47);
    270277      this.pairwiseLabel.MaximumSize = new System.Drawing.Size(16, 16);
    271278      this.pairwiseLabel.MinimumSize = new System.Drawing.Size(16, 16);
     
    293300      this.equalDistsTextBox.Name = "equalDistsTextBox";
    294301      this.equalDistsTextBox.ReadOnly = true;
    295       this.equalDistsTextBox.Size = new System.Drawing.Size(274, 20);
     302      this.equalDistsTextBox.Size = new System.Drawing.Size(213, 20);
    296303      this.equalDistsTextBox.TabIndex = 18;
    297304      //
     
    315322      this.groupCompComboBox.Location = new System.Drawing.Point(123, 19);
    316323      this.groupCompComboBox.Name = "groupCompComboBox";
    317       this.groupCompComboBox.Size = new System.Drawing.Size(259, 21);
     324      this.groupCompComboBox.Size = new System.Drawing.Size(198, 21);
    318325      this.groupCompComboBox.TabIndex = 17;
    319326      this.groupCompComboBox.SelectedValueChanged += new System.EventHandler(this.groupCompComboBox_SelectedValueChanged);
     
    329336      this.allGroupTestGroupBox.Location = new System.Drawing.Point(3, 237);
    330337      this.allGroupTestGroupBox.Name = "allGroupTestGroupBox";
    331       this.allGroupTestGroupBox.Size = new System.Drawing.Size(388, 46);
     338      this.allGroupTestGroupBox.Size = new System.Drawing.Size(327, 46);
    332339      this.allGroupTestGroupBox.TabIndex = 21;
    333340      this.allGroupTestGroupBox.TabStop = false;
     
    338345      this.groupCompLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    339346      this.groupCompLabel.AutoSize = true;
    340       this.groupCompLabel.Location = new System.Drawing.Point(366, 22);
     347      this.groupCompLabel.Location = new System.Drawing.Point(305, 22);
    341348      this.groupCompLabel.MaximumSize = new System.Drawing.Size(16, 16);
    342349      this.groupCompLabel.MinimumSize = new System.Drawing.Size(16, 16);
     
    355362      this.normalityGroupBox.Location = new System.Drawing.Point(3, 88);
    356363      this.normalityGroupBox.Name = "normalityGroupBox";
    357       this.normalityGroupBox.Size = new System.Drawing.Size(388, 143);
     364      this.normalityGroupBox.Size = new System.Drawing.Size(327, 143);
    358365      this.normalityGroupBox.TabIndex = 20;
    359366      this.normalityGroupBox.TabStop = false;
     
    383390      this.normalityStringConvertibleMatrixView.ShowRowsAndColumnsTextBox = false;
    384391      this.normalityStringConvertibleMatrixView.ShowStatisticalInformation = false;
    385       this.normalityStringConvertibleMatrixView.Size = new System.Drawing.Size(373, 102);
     392      this.normalityStringConvertibleMatrixView.Size = new System.Drawing.Size(312, 102);
    386393      this.normalityStringConvertibleMatrixView.TabIndex = 17;
    387394      //
     
    404411      this.selectDataGroupBox.Location = new System.Drawing.Point(3, 3);
    405412      this.selectDataGroupBox.Name = "selectDataGroupBox";
    406       this.selectDataGroupBox.Size = new System.Drawing.Size(388, 79);
     413      this.selectDataGroupBox.Size = new System.Drawing.Size(327, 79);
    407414      this.selectDataGroupBox.TabIndex = 19;
    408415      this.selectDataGroupBox.TabStop = false;
    409416      this.selectDataGroupBox.Text = "1. Select Data";
    410417      //
     418      // tabControl
     419      //
     420      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     421            | System.Windows.Forms.AnchorStyles.Left)
     422            | System.Windows.Forms.AnchorStyles.Right)));
     423      this.tabControl.Controls.Add(this.tabPage1);
     424      this.tabControl.Controls.Add(this.tabPage2);
     425      this.tabControl.Location = new System.Drawing.Point(3, 3);
     426      this.tabControl.Name = "tabControl";
     427      this.tabControl.SelectedIndex = 0;
     428      this.tabControl.Size = new System.Drawing.Size(930, 567);
     429      this.tabControl.TabIndex = 21;
     430      //
     431      // tabPage1
     432      //
     433      this.tabPage1.Controls.Add(this.splitContainer3);
     434      this.tabPage1.Location = new System.Drawing.Point(4, 22);
     435      this.tabPage1.Name = "tabPage1";
     436      this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
     437      this.tabPage1.Size = new System.Drawing.Size(922, 541);
     438      this.tabPage1.TabIndex = 0;
     439      this.tabPage1.Text = "Tests";
     440      this.tabPage1.UseVisualStyleBackColor = true;
     441      //
     442      // tabPage2
     443      //
     444      this.tabPage2.Controls.Add(this.dataTableView);
     445      this.tabPage2.Location = new System.Drawing.Point(4, 22);
     446      this.tabPage2.Name = "tabPage2";
     447      this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
     448      this.tabPage2.Size = new System.Drawing.Size(922, 541);
     449      this.tabPage2.TabIndex = 1;
     450      this.tabPage2.Text = "Histogram";
     451      this.tabPage2.UseVisualStyleBackColor = true;
     452      //
     453      // dataTableView
     454      //
     455      this.dataTableView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     456            | System.Windows.Forms.AnchorStyles.Left)
     457            | System.Windows.Forms.AnchorStyles.Right)));
     458      this.dataTableView.Caption = "DataTable View";
     459      this.dataTableView.Content = null;
     460      this.dataTableView.Location = new System.Drawing.Point(6, 6);
     461      this.dataTableView.Name = "dataTableView";
     462      this.dataTableView.ReadOnly = false;
     463      this.dataTableView.Size = new System.Drawing.Size(910, 529);
     464      this.dataTableView.TabIndex = 0;
     465      //
    411466      // StatisticalTestingView
    412467      //
    413       this.Controls.Add(this.splitContainer3);
     468      this.Controls.Add(this.tabControl);
    414469      this.Name = "StatisticalTestingView";
    415       this.Size = new System.Drawing.Size(1089, 546);
     470      this.Size = new System.Drawing.Size(936, 573);
    416471      this.contextMenuStrip1.ResumeLayout(false);
    417472      this.splitContainer1.Panel1.ResumeLayout(false);
     
    432487      this.normalityGroupBox.PerformLayout();
    433488      this.selectDataGroupBox.ResumeLayout(false);
     489      this.tabControl.ResumeLayout(false);
     490      this.tabPage1.ResumeLayout(false);
     491      this.tabPage2.ResumeLayout(false);
    434492      this.ResumeLayout(false);
    435493
     
    462520    private Data.Views.StringConvertibleMatrixView pairwiseStringConvertibleMatrixView;
    463521    private System.Windows.Forms.Label label4;
     522    private System.Windows.Forms.TabControl tabControl;
     523    private System.Windows.Forms.TabPage tabPage1;
     524    private System.Windows.Forms.TabPage tabPage2;
     525    private Views.DataTableView dataTableView;
    464526  }
    465527}
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.resx

    r9936 r9937  
    119119  </resheader>
    120120  <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    121     <value>133, 17</value>
     121    <value>28, 18</value>
    122122  </metadata>
    123123  <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    124     <value>54</value>
     124    <value>50</value>
    125125  </metadata>
    126126</root>
Note: See TracChangeset for help on using the changeset viewer.