Changeset 8599


Ignore:
Timestamp:
09/07/12 16:01:26 (10 years ago)
Author:
sforsten
Message:

#1942: Training and test partition can be defined (with a TrackBar in percent), when importing a csv file for data analysis problems.

Location:
trunk/sources
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3

    • Property svn:ignore
      •  

        old new  
        11Plugin.cs
         2bin
         3obj
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisImportTypeDialog.Designer.cs

    r8598 r8599  
    2727      this.OkButton = new System.Windows.Forms.Button();
    2828      this.CancelButton = new System.Windows.Forms.Button();
     29      this.TrainingTestTrackBar = new System.Windows.Forms.TrackBar();
     30      this.TrainingTestGroupBox = new System.Windows.Forms.GroupBox();
     31      this.TestLabel = new System.Windows.Forms.Label();
     32      this.TrainingLabel = new System.Windows.Forms.Label();
     33      ((System.ComponentModel.ISupportInitialize)(this.TrainingTestTrackBar)).BeginInit();
     34      this.TrainingTestGroupBox.SuspendLayout();
    2935      this.SuspendLayout();
    3036      //
     
    3238      //
    3339      this.ShuffelDataCheckbox.AutoSize = true;
    34       this.ShuffelDataCheckbox.Location = new System.Drawing.Point(61, 12);
     40      this.ShuffelDataCheckbox.Location = new System.Drawing.Point(18, 12);
    3541      this.ShuffelDataCheckbox.Name = "ShuffelDataCheckbox";
    3642      this.ShuffelDataCheckbox.Size = new System.Drawing.Size(91, 17);
     
    4248      //
    4349      this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    44       this.OkButton.Location = new System.Drawing.Point(12, 35);
     50      this.OkButton.Location = new System.Drawing.Point(18, 121);
    4551      this.OkButton.Name = "OkButton";
    4652      this.OkButton.Size = new System.Drawing.Size(75, 23);
     
    5258      //
    5359      this.CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    54       this.CancelButton.Location = new System.Drawing.Point(115, 35);
     60      this.CancelButton.Location = new System.Drawing.Point(142, 121);
    5561      this.CancelButton.Name = "CancelButton";
    5662      this.CancelButton.Size = new System.Drawing.Size(75, 23);
     
    5965      this.CancelButton.UseVisualStyleBackColor = true;
    6066      //
     67      // TrainingTestTrackBar
     68      //
     69      this.TrainingTestTrackBar.Location = new System.Drawing.Point(6, 19);
     70      this.TrainingTestTrackBar.Maximum = 100;
     71      this.TrainingTestTrackBar.Name = "TrainingTestTrackBar";
     72      this.TrainingTestTrackBar.Size = new System.Drawing.Size(210, 45);
     73      this.TrainingTestTrackBar.TabIndex = 4;
     74      this.TrainingTestTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
     75      this.TrainingTestTrackBar.Value = 66;
     76      this.TrainingTestTrackBar.ValueChanged += new System.EventHandler(this.TrainingTestTrackBar_ValueChanged);
     77      //
     78      // TrainingTestGroupBox
     79      //
     80      this.TrainingTestGroupBox.Controls.Add(this.TestLabel);
     81      this.TrainingTestGroupBox.Controls.Add(this.TrainingLabel);
     82      this.TrainingTestGroupBox.Controls.Add(this.TrainingTestTrackBar);
     83      this.TrainingTestGroupBox.Location = new System.Drawing.Point(4, 35);
     84      this.TrainingTestGroupBox.Name = "TrainingTestGroupBox";
     85      this.TrainingTestGroupBox.Size = new System.Drawing.Size(222, 80);
     86      this.TrainingTestGroupBox.TabIndex = 5;
     87      this.TrainingTestGroupBox.TabStop = false;
     88      this.TrainingTestGroupBox.Text = "Training/Test";
     89      //
     90      // TestLabel
     91      //
     92      this.TestLabel.AutoSize = true;
     93      this.TestLabel.Location = new System.Drawing.Point(108, 51);
     94      this.TestLabel.Name = "TestLabel";
     95      this.TestLabel.Size = new System.Drawing.Size(57, 13);
     96      this.TestLabel.TabIndex = 6;
     97      this.TestLabel.Text = "Test: 34 %";
     98      //
     99      // TrainingLabel
     100      //
     101      this.TrainingLabel.AutoSize = true;
     102      this.TrainingLabel.Location = new System.Drawing.Point(11, 51);
     103      this.TrainingLabel.Name = "TrainingLabel";
     104      this.TrainingLabel.Size = new System.Drawing.Size(74, 13);
     105      this.TrainingLabel.TabIndex = 5;
     106      this.TrainingLabel.Text = "Training: 66 %";
     107      //
    61108      // DataAnalysisImportTypeDialog
    62109      //
    63110      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    64111      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    65       this.ClientSize = new System.Drawing.Size(202, 69);
     112      this.ClientSize = new System.Drawing.Size(229, 151);
    66113      this.Controls.Add(this.CancelButton);
    67114      this.Controls.Add(this.OkButton);
    68115      this.Controls.Add(this.ShuffelDataCheckbox);
     116      this.Controls.Add(this.TrainingTestGroupBox);
    69117      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
    70118      this.Name = "DataAnalysisImportTypeDialog";
    71119      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
    72120      this.Text = "DataAnalysisImportTypeDialog";
     121      ((System.ComponentModel.ISupportInitialize)(this.TrainingTestTrackBar)).EndInit();
     122      this.TrainingTestGroupBox.ResumeLayout(false);
     123      this.TrainingTestGroupBox.PerformLayout();
    73124      this.ResumeLayout(false);
    74125      this.PerformLayout();
     126
    75127    }
    76128
     
    80132    protected System.Windows.Forms.Button OkButton;
    81133    protected System.Windows.Forms.Button CancelButton;
     134    private System.Windows.Forms.TrackBar TrainingTestTrackBar;
     135    private System.Windows.Forms.GroupBox TrainingTestGroupBox;
     136    private System.Windows.Forms.Label TestLabel;
     137    private System.Windows.Forms.Label TrainingLabel;
    82138
    83139  }
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisImportTypeDialog.cs

    r8598 r8599  
    2525  public partial class DataAnalysisImportTypeDialog : Form {
    2626
    27     public bool Shuffel { get { return ShuffelDataCheckbox.Checked; } }
     27    public DataAnalysisImportType ImportType {
     28      get {
     29        return new DataAnalysisImportType() {
     30          Shuffle = ShuffelDataCheckbox.Checked,
     31          Training = TrainingTestTrackBar.Value
     32        };
     33      }
     34    }
    2835
    2936    public DataAnalysisImportTypeDialog() {
    3037      InitializeComponent();
    3138    }
     39
     40    private void TrainingTestTrackBar_ValueChanged(object sender, System.EventArgs e) {
     41      TrainingLabel.Text = "Training: " + TrainingTestTrackBar.Value + " %";
     42      TestLabel.Text = "Test: " + (TrainingTestTrackBar.Maximum - TrainingTestTrackBar.Value) + " %";
     43    }
    3244  }
    3345}
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisInstanceConsumerView.cs

    r8598 r8599  
    2525using HeuristicLab.MainForm;
    2626using HeuristicLab.Problems.DataAnalysis;
    27 using HeuristicLab.Problems.Instances.DataAnalysis;
    28 using HeuristicLab.Problems.Instances.DataAnalysis.Views;
    2927using HeuristicLab.Problems.Instances.Views;
    3028
     
    5553            DataAnalysisImportTypeDialog importTypeDialog = new DataAnalysisImportTypeDialog();
    5654            if (importTypeDialog.ShowDialog() == DialogResult.OK) {
    57               instance = provider.ImportData(openFileDialog.FileName, new DataAnalysisImportType() { Shuffle = importTypeDialog.Shuffel });
     55              instance = provider.ImportData(openFileDialog.FileName, importTypeDialog.ImportType);
    5856            } else {
    5957              return;
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/HeuristicLab.Problems.Instances.DataAnalysis.Views-3.3.csproj

    r8598 r8599  
    5555      <DependentUpon>DataAnalysisImportTypeDialog.cs</DependentUpon>
    5656    </Compile>
    57     <Compile Include="DataAnalysisInstanceConsumerView.cs" />
     57    <Compile Include="DataAnalysisInstanceConsumerView.cs">
     58      <SubType>UserControl</SubType>
     59    </Compile>
    5860    <Compile Include="DataAnalysisInstanceConsumerView.Designer.cs">
    5961      <DependentUpon>DataAnalysisInstanceConsumerView.cs</DependentUpon>
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs

    r8598 r8599  
    7070      var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
    7171      foreach (var variableName in dataset.DoubleVariables) {
    72         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     72        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    7373          variableName != targetVar)
    7474          allowedInputVars.Add(variableName);
     
    102102      // turn of input variables that are constant in the training partition
    103103      var allowedInputVars = new List<string>();
    104       var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
     104      int trainingPartEnd = (csvFileParser.Rows * type.Training) / 100;
     105      var trainingIndizes = Enumerable.Range(0, trainingPartEnd);
    105106      foreach (var variableName in dataset.DoubleVariables) {
    106         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     107        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    107108          variableName != targetVar)
    108109          allowedInputVars.Add(variableName);
     
    111112      ClassificationProblemData classificationData = new ClassificationProblemData(dataset, allowedInputVars, targetVar);
    112113
    113       int trainingPartEnd = trainingIndizes.Last();
    114       classificationData.TrainingPartition.Start = trainingIndizes.First();
     114      classificationData.TrainingPartition.Start = 0;
    115115      classificationData.TrainingPartition.End = trainingPartEnd;
    116116      classificationData.TestPartition.Start = trainingPartEnd;
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Clustering/CSV/ClusteringCSVInstanceProvider.cs

    r8598 r8599  
    6969      var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
    7070      foreach (var variableName in dataset.DoubleVariables) {
    71         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     71        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    7272          variableName != targetVar)
    7373          allowedInputVars.Add(variableName);
     
    101101      // turn of input variables that are constant in the training partition
    102102      var allowedInputVars = new List<string>();
    103       var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
     103      int trainingPartEnd = (csvFileParser.Rows * type.Training) / 100;
     104      var trainingIndizes = Enumerable.Range(0, trainingPartEnd);
    104105      foreach (var variableName in dataset.DoubleVariables) {
    105         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     106        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    106107          variableName != targetVar)
    107108          allowedInputVars.Add(variableName);
     
    110111      ClusteringProblemData clusteringData = new ClusteringProblemData(dataset, allowedInputVars);
    111112
    112       int trainingPartEnd = trainingIndizes.Last();
    113       clusteringData.TrainingPartition.Start = trainingIndizes.First();
     113      clusteringData.TrainingPartition.Start = 0;
    114114      clusteringData.TrainingPartition.End = trainingPartEnd;
    115115      clusteringData.TestPartition.Start = trainingPartEnd;
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/CSV/RegressionCSVInstanceProvider.cs

    r8598 r8599  
    6868      var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
    6969      foreach (var variableName in dataset.DoubleVariables) {
    70         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     70        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    7171          variableName != targetVar)
    7272          allowedInputVars.Add(variableName);
     
    9999      // turn of input variables that are constant in the training partition
    100100      var allowedInputVars = new List<string>();
    101       var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
     101      int trainingPartEnd = (csvFileParser.Rows * type.Training) / 100;
     102      var trainingIndizes = Enumerable.Range(0, trainingPartEnd);
    102103      foreach (var variableName in dataset.DoubleVariables) {
    103         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     104        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    104105          variableName != targetVar)
    105106          allowedInputVars.Add(variableName);
     
    108109      RegressionProblemData regressionData = new RegressionProblemData(dataset, allowedInputVars, targetVar);
    109110
    110       int trainingPartEnd = trainingIndizes.Last();
    111       regressionData.TrainingPartition.Start = trainingIndizes.First();
     111      regressionData.TrainingPartition.Start = 0;
    112112      regressionData.TrainingPartition.End = trainingPartEnd;
    113113      regressionData.TestPartition.Start = trainingPartEnd;
Note: See TracChangeset for help on using the changeset viewer.