Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8885


Ignore:
Timestamp:
11/08/12 16:43:08 (11 years ago)
Author:
sforsten
Message:

#1942:

  • implemented changes suggested by mkommend in comment:15:ticket:1942 except the first remark
  • TimeSeriesPrognosisInstanceProvider has been adapted to work similar to other DataAnalysisInstanceProvider, also views have been created for it
Location:
trunk/sources
Files:
5 added
19 edited

Legend:

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

    r8877 r8885  
    1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    223  partial class ClassificationImportTypeDialog {
    324    /// <summary>
     
    2445    /// </summary>
    2546    private void InitializeComponent() {
     47      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ClassificationImportTypeDialog));
    2648      this.TargetVariableComboBox = new System.Windows.Forms.ComboBox();
    2749      this.TargetVariableLabel = new System.Windows.Forms.Label();
    2850      this.TargetVariableInfoLabel = new System.Windows.Forms.Label();
     51      this.UniformDistributionOfClassesCheckbox = new System.Windows.Forms.CheckBox();
     52      this.UniformDistributClassValuesInfoLabel = new System.Windows.Forms.Label();
    2953      ((System.ComponentModel.ISupportInitialize)(this.TrainingTestTrackBar)).BeginInit();
    3054      this.CSVSettingsGroupBox.SuspendLayout();
     
    3256      this.SuspendLayout();
    3357      //
     58      // ShuffleDataCheckbox
     59      //
     60      this.ShuffleDataCheckbox.CheckedChanged += new System.EventHandler(this.ShuffleDataCheckbox_CheckedChanged);
     61      //
     62      // OkButton
     63      //
     64      this.OkButton.Location = new System.Drawing.Point(303, 464);
     65      //
     66      // TrainingTestTrackBar
     67      //
     68      this.TrainingTestTrackBar.Location = new System.Drawing.Point(6, 70);
     69      //
     70      // TestLabel
     71      //
     72      this.TestLabel.Location = new System.Drawing.Point(303, 95);
     73      //
     74      // TrainingLabel
     75      //
     76      this.TrainingLabel.Location = new System.Drawing.Point(76, 95);
     77      //
     78      // CancelationButton
     79      //
     80      this.CancelationButton.Location = new System.Drawing.Point(384, 464);
     81      //
    3482      // ProblemDataSettingsGroupBox
    3583      //
     84      this.ProblemDataSettingsGroupBox.Controls.Add(this.UniformDistributClassValuesInfoLabel);
    3685      this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableInfoLabel);
    3786      this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableLabel);
    3887      this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableComboBox);
    39       this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.PreviewLabel, 0);
    40       this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffelInfoLabel, 0);
     88      this.ProblemDataSettingsGroupBox.Controls.Add(this.UniformDistributionOfClassesCheckbox);
     89      this.ProblemDataSettingsGroupBox.Size = new System.Drawing.Size(447, 315);
     90      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.UniformDistributionOfClassesCheckbox, 0);
    4191      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TargetVariableComboBox, 0);
    42       this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffleDataCheckbox, 0);
    4392      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TargetVariableLabel, 0);
    4493      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TargetVariableInfoLabel, 0);
     94      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.UniformDistributClassValuesInfoLabel, 0);
     95      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.PreviewLabel, 0);
    4596      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TrainingTestTrackBar, 0);
    4697      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TrainingLabel, 0);
     98      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TestLabel, 0);
     99      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffelInfoLabel, 0);
     100      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffleDataCheckbox, 0);
    47101      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.PreviewDatasetMatrix, 0);
    48       this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TestLabel, 0);
    49102      this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ErrorTextBox, 0);
    50103      //
     104      // ErrorTextBox
     105      //
     106      this.ErrorTextBox.Location = new System.Drawing.Point(6, 19);
     107      this.ErrorTextBox.Size = new System.Drawing.Size(435, 96);
     108      //
     109      // PreviewDatasetMatrix
     110      //
     111      this.PreviewDatasetMatrix.Location = new System.Drawing.Point(6, 134);
     112      this.PreviewDatasetMatrix.Size = new System.Drawing.Size(435, 175);
     113      //
     114      // PreviewLabel
     115      //
     116      this.PreviewLabel.Location = new System.Drawing.Point(6, 118);
     117      //
    51118      // TargetVariableComboBox
    52119      //
    53120      this.TargetVariableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    54                   | System.Windows.Forms.AnchorStyles.Right)));
     121            | System.Windows.Forms.AnchorStyles.Right)));
    55122      this.TargetVariableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    56123      this.TargetVariableComboBox.FormattingEnabled = true;
    57       this.TargetVariableComboBox.Location = new System.Drawing.Point(230, 19);
     124      this.TargetVariableComboBox.Location = new System.Drawing.Point(94, 43);
    58125      this.TargetVariableComboBox.Name = "TargetVariableComboBox";
    59       this.TargetVariableComboBox.Size = new System.Drawing.Size(181, 21);
     126      this.TargetVariableComboBox.Size = new System.Drawing.Size(317, 21);
    60127      this.TargetVariableComboBox.TabIndex = 10;
    61128      //
     
    63130      //
    64131      this.TargetVariableLabel.AutoSize = true;
    65       this.TargetVariableLabel.Location = new System.Drawing.Point(142, 22);
     132      this.TargetVariableLabel.Location = new System.Drawing.Point(6, 46);
    66133      this.TargetVariableLabel.Name = "TargetVariableLabel";
    67134      this.TargetVariableLabel.Size = new System.Drawing.Size(82, 13);
     
    69136      this.TargetVariableLabel.Text = "Target Variable:";
    70137      //
    71       // TargetVariableinfoLabel
    72       //
    73       this.TargetVariableInfoLabel.Location = new System.Drawing.Point(421, 21);
    74       this.TargetVariableInfoLabel.Name = "Target Variable Info";
     138      // TargetVariableInfoLabel
     139      //
     140      this.TargetVariableInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     141      this.TargetVariableInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
     142      this.TargetVariableInfoLabel.Location = new System.Drawing.Point(421, 45);
     143      this.TargetVariableInfoLabel.Name = "TargetVariableInfoLabel";
    75144      this.TargetVariableInfoLabel.Size = new System.Drawing.Size(16, 16);
    76145      this.TargetVariableInfoLabel.TabIndex = 21;
    77146      this.TargetVariableInfoLabel.Tag = "Select the target variable of the csv file.";
    78       this.TargetVariableInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
     147      this.ToolTip.SetToolTip(this.TargetVariableInfoLabel, (string)this.TargetVariableInfoLabel.Tag);
    79148      this.TargetVariableInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick);
     149      //
     150      // UniformDistributionOfClassesCheckbox
     151      //
     152      this.UniformDistributionOfClassesCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     153      this.UniformDistributionOfClassesCheckbox.AutoSize = true;
     154      this.UniformDistributionOfClassesCheckbox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     155      this.UniformDistributionOfClassesCheckbox.Enabled = false;
     156      this.UniformDistributionOfClassesCheckbox.Location = new System.Drawing.Point(259, 19);
     157      this.UniformDistributionOfClassesCheckbox.Name = "UniformDistributionOfClassesCheckbox";
     158      this.UniformDistributionOfClassesCheckbox.Size = new System.Drawing.Size(152, 17);
     159      this.UniformDistributionOfClassesCheckbox.TabIndex = 22;
     160      this.UniformDistributionOfClassesCheckbox.Text = "Uniformly distribute classes";
     161      this.UniformDistributionOfClassesCheckbox.UseVisualStyleBackColor = true;
     162      //
     163      // UniformDistributClassValuesInfoLabel
     164      //
     165      this.UniformDistributClassValuesInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     166      this.UniformDistributClassValuesInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
     167      this.UniformDistributClassValuesInfoLabel.Location = new System.Drawing.Point(421, 20);
     168      this.UniformDistributClassValuesInfoLabel.Name = "UniformDistributClassValuesInfoLabel";
     169      this.UniformDistributClassValuesInfoLabel.Size = new System.Drawing.Size(16, 16);
     170      this.UniformDistributClassValuesInfoLabel.TabIndex = 23;
     171      this.UniformDistributClassValuesInfoLabel.Tag = "Check, if classes should be distributed uniformly between training and test. This" +
     172    " can change the distribution of training and test a little bit.";
     173      this.ToolTip.SetToolTip(this.UniformDistributClassValuesInfoLabel, (string)this.UniformDistributClassValuesInfoLabel.Tag);
     174      this.UniformDistributClassValuesInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick);
    80175      //
    81176      // ClassificationImportTypeDialog
     
    83178      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    84179      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    85       this.ClientSize = new System.Drawing.Size(471, 442);
     180      this.ClientSize = new System.Drawing.Size(471, 499);
    86181      this.Name = "ClassificationImportTypeDialog";
    87182      this.Text = "Classification CSV Import";
     
    95190
    96191    }
    97 
    98192    #endregion
    99193
    100     private System.Windows.Forms.ComboBox TargetVariableComboBox;
    101     private System.Windows.Forms.Label TargetVariableLabel;
     194    protected System.Windows.Forms.ComboBox TargetVariableComboBox;
     195    protected System.Windows.Forms.Label TargetVariableLabel;
    102196    protected System.Windows.Forms.Label TargetVariableInfoLabel;
    103 
    104 
     197    protected System.Windows.Forms.Label UniformDistributClassValuesInfoLabel;
     198    protected System.Windows.Forms.CheckBox UniformDistributionOfClassesCheckbox;
    105199  }
    106200}
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClassificationImportTypeDialog.cs

    r8877 r8885  
    3333          Shuffle = ShuffleDataCheckbox.Checked,
    3434          Training = TrainingTestTrackBar.Value,
    35           TargetVariable = (String)TargetVariableComboBox.SelectedValue
     35          TargetVariable = (String)TargetVariableComboBox.SelectedValue,
     36          UniformlyDistributeClasses = UniformDistributionOfClassesCheckbox.Checked
    3637        };
    3738      }
     
    4041    public ClassificationImportTypeDialog() {
    4142      InitializeComponent();
    42 
    43       ToolTip.SetToolTip(TargetVariableInfoLabel, (string)TargetVariableInfoLabel.Tag);
    4443    }
    4544
     
    5857      }
    5958    }
     59
     60    private void ShuffleDataCheckbox_CheckedChanged(object sender, System.EventArgs e) {
     61      UniformDistributionOfClassesCheckbox.Enabled = ShuffleDataCheckbox.Checked;
     62    }
    6063  }
    6164}
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClassificationInstanceConsumerView.Designer.cs

    r8877 r8885  
    1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    223  partial class ClassificationInstanceConsumerView {
    324    /// <summary>
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClassificationInstanceConsumerView.cs

    r8877 r8885  
    4848            instance = provider.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat);
    4949          }
    50           catch (Exception ex) {
    51             MessageBox.Show(String.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);
     50          catch (IOException ex) {
     51            ErrorWhileParsing(ex);
    5252            return;
    5353          }
     
    5555            GenericConsumer.Load(instance);
    5656          }
    57           catch (Exception ex) {
    58             MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(importTypeDialog.Path), Environment.NewLine + ex.Message), "Cannot load instance");
     57          catch (IOException ex) {
     58            ErrorWhileLoading(ex, importTypeDialog.Path);
    5959          }
    6060        } else {
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisImportTypeDialog.Designer.cs

    r8877 r8885  
    1 
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
    222namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    323  partial class DataAnalysisImportTypeDialog {
     
    2646    private void InitializeComponent() {
    2747      this.components = new System.ComponentModel.Container();
    28       System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataAnalysisImportTypeDialog));
    2948      this.ShuffleDataCheckbox = new System.Windows.Forms.CheckBox();
    3049      this.OkButton = new System.Windows.Forms.Button();
     
    3251      this.TestLabel = new System.Windows.Forms.Label();
    3352      this.TrainingLabel = new System.Windows.Forms.Label();
    34       this.CancelButton = new System.Windows.Forms.Button();
     53      this.CancelationButton = new System.Windows.Forms.Button();
    3554      this.OpenFileButton = new System.Windows.Forms.Button();
    3655      this.ProblemFileLabel = new System.Windows.Forms.Label();
     
    7493      this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    7594      this.OkButton.Enabled = false;
    76       this.OkButton.Location = new System.Drawing.Point(87, 407);
     95      this.OkButton.Location = new System.Drawing.Point(303, 407);
    7796      this.OkButton.Name = "OkButton";
    7897      this.OkButton.Size = new System.Drawing.Size(75, 23);
     
    84103      //
    85104      this.TrainingTestTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    86                   | System.Windows.Forms.AnchorStyles.Right)));
     105            | System.Windows.Forms.AnchorStyles.Right)));
    87106      this.TrainingTestTrackBar.Location = new System.Drawing.Point(6, 43);
    88107      this.TrainingTestTrackBar.Maximum = 100;
     
    114133      this.TrainingLabel.Text = "Training: 66 %";
    115134      //
    116       // CancelButton
    117       //
    118       this.CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    119       this.CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    120       this.CancelButton.Location = new System.Drawing.Point(318, 407);
    121       this.CancelButton.Name = "CancelButton";
    122       this.CancelButton.Size = new System.Drawing.Size(75, 23);
    123       this.CancelButton.TabIndex = 3;
    124       this.CancelButton.Text = "&Cancel";
    125       this.CancelButton.UseVisualStyleBackColor = true;
     135      // CancelationButton
     136      //
     137      this.CancelationButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     138      this.CancelationButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     139      this.CancelationButton.Location = new System.Drawing.Point(384, 407);
     140      this.CancelationButton.Name = "CancelationButton";
     141      this.CancelationButton.Size = new System.Drawing.Size(75, 23);
     142      this.CancelationButton.TabIndex = 3;
     143      this.CancelationButton.Text = "&Cancel";
     144      this.CancelationButton.UseVisualStyleBackColor = true;
    126145      //
    127146      // OpenFileButton
     
    148167      //
    149168      this.ProblemTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    150                   | System.Windows.Forms.AnchorStyles.Right)));
     169            | System.Windows.Forms.AnchorStyles.Right)));
    151170      this.ProblemTextBox.Location = new System.Drawing.Point(91, 6);
    152171      this.ProblemTextBox.Name = "ProblemTextBox";
     
    162181      //
    163182      this.DateTimeFormatComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    164                   | System.Windows.Forms.AnchorStyles.Right)));
     183            | System.Windows.Forms.AnchorStyles.Right)));
    165184      this.DateTimeFormatComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    166185      this.DateTimeFormatComboBox.FormattingEnabled = true;
     
    174193      //
    175194      this.DecimalSeparatorComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    176                   | System.Windows.Forms.AnchorStyles.Right)));
     195            | System.Windows.Forms.AnchorStyles.Right)));
    177196      this.DecimalSeparatorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    178197      this.DecimalSeparatorComboBox.FormattingEnabled = true;
     
    213232      //
    214233      this.SeparatorComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    215                   | System.Windows.Forms.AnchorStyles.Right)));
     234            | System.Windows.Forms.AnchorStyles.Right)));
    216235      this.SeparatorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    217236      this.SeparatorComboBox.FormattingEnabled = true;
     
    225244      //
    226245      this.CSVSettingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    227                   | System.Windows.Forms.AnchorStyles.Right)));
     246            | System.Windows.Forms.AnchorStyles.Right)));
    228247      this.CSVSettingsGroupBox.Controls.Add(this.DateTimeFormatInfoLabel);
    229248      this.CSVSettingsGroupBox.Controls.Add(this.DecimalSeparatorInfoLabel);
     
    245264      //
    246265      this.DateTimeFormatInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     266      this.DateTimeFormatInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
    247267      this.DateTimeFormatInfoLabel.Location = new System.Drawing.Point(421, 76);
    248       this.DateTimeFormatInfoLabel.Name = "DateTime Format Info";
     268      this.DateTimeFormatInfoLabel.Name = "DateTimeFormatInfoLabel";
    249269      this.DateTimeFormatInfoLabel.Size = new System.Drawing.Size(16, 16);
    250270      this.DateTimeFormatInfoLabel.TabIndex = 23;
    251271      this.DateTimeFormatInfoLabel.Tag = "Select the date time format used in the csv file";
    252       this.DateTimeFormatInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
     272      this.ToolTip.SetToolTip(this.DateTimeFormatInfoLabel, "Select the date time format used in the csv file");
    253273      this.DateTimeFormatInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick);
    254274      //
     
    256276      //
    257277      this.DecimalSeparatorInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     278      this.DecimalSeparatorInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
    258279      this.DecimalSeparatorInfoLabel.Location = new System.Drawing.Point(421, 49);
    259       this.DecimalSeparatorInfoLabel.Name = "Decimal Separator Info";
     280      this.DecimalSeparatorInfoLabel.Name = "DecimalSeparatorInfoLabel";
    260281      this.DecimalSeparatorInfoLabel.Size = new System.Drawing.Size(16, 16);
    261282      this.DecimalSeparatorInfoLabel.TabIndex = 22;
    262283      this.DecimalSeparatorInfoLabel.Tag = "Select the decimal separator used to for double values";
    263       this.DecimalSeparatorInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
     284      this.ToolTip.SetToolTip(this.DecimalSeparatorInfoLabel, "Select the decimal separator used to for double values");
    264285      this.DecimalSeparatorInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick);
    265286      //
     
    267288      //
    268289      this.SeparatorInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     290      this.SeparatorInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
    269291      this.SeparatorInfoLabel.Location = new System.Drawing.Point(421, 22);
    270       this.SeparatorInfoLabel.Name = "Separator Info";
     292      this.SeparatorInfoLabel.Name = "SeparatorInfoLabel";
    271293      this.SeparatorInfoLabel.Size = new System.Drawing.Size(16, 16);
    272294      this.SeparatorInfoLabel.TabIndex = 21;
    273295      this.SeparatorInfoLabel.Tag = "Select the separator used to separate columns in the csv file.";
    274       this.SeparatorInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
     296      this.ToolTip.SetToolTip(this.SeparatorInfoLabel, "Select the separator used to separate columns in the csv file.");
    275297      this.SeparatorInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick);
    276298      //
     
    278300      //
    279301      this.ProblemDataSettingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    280                   | System.Windows.Forms.AnchorStyles.Left)
    281                   | System.Windows.Forms.AnchorStyles.Right)));
     302            | System.Windows.Forms.AnchorStyles.Left)
     303            | System.Windows.Forms.AnchorStyles.Right)));
    282304      this.ProblemDataSettingsGroupBox.Controls.Add(this.ErrorTextBox);
    283305      this.ProblemDataSettingsGroupBox.Controls.Add(this.ShuffelInfoLabel);
     
    306328      // ShuffelInfoLabel
    307329      //
     330      this.ShuffelInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
    308331      this.ShuffelInfoLabel.Location = new System.Drawing.Point(111, 20);
    309       this.ShuffelInfoLabel.Name = "Shuffle Info";
     332      this.ShuffelInfoLabel.Name = "ShuffelInfoLabel";
    310333      this.ShuffelInfoLabel.Size = new System.Drawing.Size(16, 16);
    311334      this.ShuffelInfoLabel.TabIndex = 8;
    312335      this.ShuffelInfoLabel.Tag = "Check, if the importat data should be shuffled";
    313       this.ShuffelInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
     336      this.ToolTip.SetToolTip(this.ShuffelInfoLabel, "Check, if the importat data should be shuffled");
    314337      this.ShuffelInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick);
    315338      //
     
    326349      //
    327350      this.PreviewDatasetMatrix.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    328                   | System.Windows.Forms.AnchorStyles.Left)
    329                   | System.Windows.Forms.AnchorStyles.Right)));
     351            | System.Windows.Forms.AnchorStyles.Left)
     352            | System.Windows.Forms.AnchorStyles.Right)));
    330353      this.PreviewDatasetMatrix.Caption = "Dataset Preview";
    331354      this.PreviewDatasetMatrix.Content = null;
     
    350373      this.Controls.Add(this.OpenFileButton);
    351374      this.Controls.Add(this.ProblemFileLabel);
    352       this.Controls.Add(this.CancelButton);
     375      this.Controls.Add(this.CancelationButton);
    353376      this.Controls.Add(this.OkButton);
    354377      this.MaximizeBox = false;
     
    375398    protected System.Windows.Forms.Label TestLabel;
    376399    protected System.Windows.Forms.Label TrainingLabel;
    377     protected System.Windows.Forms.Button CancelButton;
     400    protected System.Windows.Forms.Button CancelationButton;
    378401    protected System.Windows.Forms.OpenFileDialog openFileDialog;
    379402    protected System.Windows.Forms.Label ProblemFileLabel;
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisImportTypeDialog.cs

    r8877 r8885  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.ComponentModel;
    2524using System.Globalization;
    2625using System.Linq;
     
    3231  public partial class DataAnalysisImportTypeDialog : Form {
    3332
    34     public static readonly BindingList<KeyValuePair<DateTimeFormatInfo, string>> dateTimeFormats = new BindingList<KeyValuePair<DateTimeFormatInfo, string>>{
     33    public static readonly List<KeyValuePair<DateTimeFormatInfo, string>> dateTimeFormats = new List<KeyValuePair<DateTimeFormatInfo, string>>{
    3534      new KeyValuePair<DateTimeFormatInfo, string>(DateTimeFormatInfo.GetInstance(new CultureInfo("de-DE")), "dd/mm/yyyy hh:MM:ss" ),
    3635      new KeyValuePair<DateTimeFormatInfo, string>(DateTimeFormatInfo.InvariantInfo, "mm/dd/yyyy hh:MM:ss" ),
     
    3938    };
    4039
    41     public static readonly BindingList<KeyValuePair<char, string>> POSSIBLE_SEPARATORS = new BindingList<KeyValuePair<char, string>>{
     40    public static readonly List<KeyValuePair<char, string>> POSSIBLE_SEPARATORS = new List<KeyValuePair<char, string>>{
    4241      new KeyValuePair<char, string>(',', ", (Comma)" ),
    4342      new KeyValuePair<char, string>(';', "; (Semicolon)" ),
     
    4544    };
    4645
    47     public static readonly BindingList<KeyValuePair<NumberFormatInfo, string>> POSSIBLE_DECIMAL_SEPARATORS = new BindingList<KeyValuePair<NumberFormatInfo, string>>{
     46    public static readonly List<KeyValuePair<NumberFormatInfo, string>> POSSIBLE_DECIMAL_SEPARATORS = new List<KeyValuePair<NumberFormatInfo, string>>{
    4847      new KeyValuePair<NumberFormatInfo, string>(NumberFormatInfo.InvariantInfo, ". (Period)" ),
    4948      new KeyValuePair<NumberFormatInfo, string>(NumberFormatInfo.GetInstance(new CultureInfo("de-DE")), ", (Comma)" )     
     
    7574    public DataAnalysisImportTypeDialog() {
    7675      InitializeComponent();
    77       ToolTip.SetToolTip(SeparatorInfoLabel, (string)SeparatorInfoLabel.Tag);
    78       ToolTip.SetToolTip(DecimalSeparatorInfoLabel, (string)DecimalSeparatorInfoLabel.Tag);
    79       ToolTip.SetToolTip(DateTimeFormatInfoLabel, (string)DateTimeFormatInfoLabel.Tag);
    80       ToolTip.SetToolTip(ShuffelInfoLabel, (string)ShuffelInfoLabel.Tag);
    8176
    8277      SeparatorComboBox.DataSource = POSSIBLE_SEPARATORS;
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisInstanceConsumerView.Designer.cs

    r8598 r8885  
    1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    223  partial class DataAnalysisInstanceConsumerView<T> {
    324    /// <summary>
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisInstanceConsumerView.cs

    r8877 r8885  
    4040    public DataAnalysisInstanceConsumerView() {
    4141      InitializeComponent();
    42 
    4342    }
    4443
     
    5150          try {
    5251            instance = provider.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat);
    53 
    5452          }
    55           catch (Exception ex) {
    56             MessageBox.Show(String.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);
     53          catch (IOException ex) {
     54            ErrorWhileParsing(ex);
    5755            return;
    5856          }
     
    6058            GenericConsumer.Load(instance);
    6159          }
    62           catch (Exception ex) {
    63             MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(importTypeDialog.Path), Environment.NewLine + ex.Message), "Cannot load instance");
     60          catch (IOException ex) {
     61            ErrorWhileLoading(ex, importTypeDialog.Path);
    6462          }
    6563        } else {
     
    7068      }
    7169    }
     70
     71    protected void ErrorWhileParsing(Exception ex) {
     72      MessageBox.Show(String.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);
     73    }
     74    protected void ErrorWhileLoading(Exception ex, string path) {
     75      MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(path), Environment.NewLine + ex.Message), "Cannot load instance");
     76    }
    7277  }
    7378}
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/HeuristicLab.Problems.Instances.DataAnalysis.Views-3.3.csproj

    r8877 r8885  
    7070  </PropertyGroup>
    7171  <ItemGroup>
     72    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     73    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     74    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     75    <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    7276    <Reference Include="System" />
    7377    <Reference Include="System.Core" />
    7478    <Reference Include="System.Drawing" />
    7579    <Reference Include="System.Windows.Forms" />
     80    <Reference Include="System.Windows.Forms.DataVisualization" />
    7681    <Reference Include="System.Xml.Linq" />
    7782    <Reference Include="System.Data.DataSetExtensions" />
     
    9297    <Compile Include="ClassificationInstanceConsumerView.Designer.cs">
    9398      <DependentUpon>ClassificationInstanceConsumerView.cs</DependentUpon>
     99    </Compile>
     100    <Compile Include="TimeSeriesPrognosisImportTypeDialog.cs">
     101      <SubType>Form</SubType>
     102    </Compile>
     103    <Compile Include="TimeSeriesPrognosisImportTypeDialog.Designer.cs">
     104      <DependentUpon>TimeSeriesPrognosisImportTypeDialog.cs</DependentUpon>
     105    </Compile>
     106    <Compile Include="TimeSeriesPrognosisInstanceConsumerView.cs">
     107      <SubType>UserControl</SubType>
     108    </Compile>
     109    <Compile Include="TimeSeriesPrognosisInstanceConsumerView.Designer.cs">
     110      <DependentUpon>TimeSeriesPrognosisInstanceConsumerView.cs</DependentUpon>
    94111    </Compile>
    95112    <Compile Include="DataAnalysisImportTypeDialog.cs">
     
    155172      <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
    156173      <Name>HeuristicLab.MainForm-3.3</Name>
     174    </ProjectReference>
     175    <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj">
     176      <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project>
     177      <Name>HeuristicLab.Optimization.Views-3.3</Name>
    157178    </ProjectReference>
    158179    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionImportTypeDialog.Designer.cs

    r8877 r8885  
    1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    223  partial class RegressionImportTypeDialog {
    324    /// <summary>
     
    79100      this.TargetVariableInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
    80101      this.TargetVariableInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick);
     102      this.ToolTip.SetToolTip(this.TargetVariableInfoLabel, (string)this.TargetVariableInfoLabel.Tag);
    81103      //
    82104      // RegressionImportTypeDialog
     
    86108      this.ClientSize = new System.Drawing.Size(471, 442);
    87109      this.Name = "RegressionImportTypeDialog";
    88       this.Text = "Classification CSV Import";
     110      this.Text = "Regression CSV Import";
    89111      ((System.ComponentModel.ISupportInitialize)(this.TrainingTestTrackBar)).EndInit();
    90112      this.CSVSettingsGroupBox.ResumeLayout(false);
     
    99121    #endregion
    100122
    101     private System.Windows.Forms.ComboBox TargetVariableComboBox;
    102     private System.Windows.Forms.Label TargetVariableLabel;
     123    protected System.Windows.Forms.ComboBox TargetVariableComboBox;
     124    protected System.Windows.Forms.Label TargetVariableLabel;
    103125    protected System.Windows.Forms.Label TargetVariableInfoLabel;
    104126
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionImportTypeDialog.cs

    r8877 r8885  
    2525
    2626namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    27 
    2827  public partial class RegressionImportTypeDialog : DataAnalysisImportTypeDialog {
    2928    public new RegressionImportType ImportType {
     
    3938    public RegressionImportTypeDialog() {
    4039      InitializeComponent();
    41 
    42       ToolTip.SetToolTip(TargetVariableInfoLabel, (string)TargetVariableInfoLabel.Tag);
    4340    }
    4441
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionInstanceConsumerView.Designer.cs

    r8877 r8885  
    1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
    223  partial class RegressionInstanceConsumerView {
    324    /// <summary>
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionInstanceConsumerView.cs

    r8877 r8885  
    4848            instance = provider.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat);
    4949          }
    50           catch (Exception ex) {
    51             MessageBox.Show(String.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);
     50          catch (IOException ex) {
     51            ErrorWhileParsing(ex);
    5252            return;
    5353          }
     
    5555            GenericConsumer.Load(instance);
    5656          }
    57           catch (Exception ex) {
    58             MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(importTypeDialog.Path), Environment.NewLine + ex.Message), "Cannot load instance");
     57          catch (IOException ex) {
     58            ErrorWhileLoading(ex, importTypeDialog.Path);
    5959          }
    6060        } else {
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs

    r8877 r8885  
    9494      List<IList> values = csvFileParser.Values;
    9595      if (type.Shuffle) {
    96         values = Shuffle(values, csvFileParser.VariableNames.ToList().FindIndex(x => x.Equals(type.TargetVariable)),
    97                          type.Training, out trainingPartEnd);
     96        values = Shuffle(values);
     97        if (type.UniformlyDistributeClasses) {
     98          values = Shuffle(values, csvFileParser.VariableNames.ToList().FindIndex(x => x.Equals(type.TargetVariable)),
     99                           type.Training, out trainingPartEnd);
     100        }
    98101      }
    99102
     
    147150      trainingPartEnd = training.First().Count;
    148151
    149       training = Shuffle(training);
    150       test = Shuffle(test);
    151152      for (int i = 0; i < training.Count; i++) {
    152153        for (int j = 0; j < test[i].Count; j++) {
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationImportType.cs

    r8877 r8885  
    2323  public class ClassificationImportType : DataAnalysisImportType {
    2424    public string TargetVariable { get; set; }
     25    public bool UniformlyDistributeClasses { get; set; }
    2526  }
    2627}
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj

    r8877 r8885  
    203203    <Compile Include="TableFileParser.cs" />
    204204    <Compile Include="TimeSeries\CSV\TimeSeriesPrognosisCSVInstanceProvider.cs" />
     205    <Compile Include="TimeSeries\TimeSeriesPrognosisImportType.cs" />
    205206    <Compile Include="TimeSeries\TimeSeriesPrognosisInstanceProvider.cs" />
    206207  </ItemGroup>
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TableFileParser.cs

    r8564 r8885  
    8383      DateTimeFormatInfo dateTimeFormatInfo;
    8484      char separator;
    85       DetermineFileFormat(new FileStream(fileName, FileMode.Open), out numberFormat, out dateTimeFormatInfo, out separator);
    86       Parse(new FileStream(fileName, FileMode.Open), numberFormat, dateTimeFormatInfo, separator);
     85      DetermineFileFormat(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), out numberFormat, out dateTimeFormatInfo, out separator);
     86      Parse(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), numberFormat, dateTimeFormatInfo, separator);
    8787    }
    8888
     
    9595    /// <param name="separator">defines the separator</param>
    9696    public void Parse(string fileName, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator) {
    97       Parse(new FileStream(fileName, FileMode.Open), numberFormat, dateTimeFormatInfo, separator);
     97      Parse(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), numberFormat, dateTimeFormatInfo, separator);
    9898    }
    9999
     
    163163
    164164    public static void DetermineFileFormat(string path, out NumberFormatInfo numberFormat, out DateTimeFormatInfo dateTimeFormatInfo, out char separator) {
    165       DetermineFileFormat(new FileStream(path, FileMode.Open), out numberFormat, out dateTimeFormatInfo, out separator);
     165      DetermineFileFormat(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), out numberFormat, out dateTimeFormatInfo, out separator);
    166166    }
    167167
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TimeSeries/CSV/TimeSeriesPrognosisCSVInstanceProvider.cs

    r7890 r8885  
    2020#endregion
    2121
     22using System;
     23using System.Collections;
     24using System.Collections.Generic;
     25using System.IO;
     26using System.Linq;
     27using HeuristicLab.Common;
     28using HeuristicLab.Problems.DataAnalysis;
    2229
    23 using System;
    24 using System.Collections.Generic;
    25 using HeuristicLab.Problems.DataAnalysis;
    2630namespace HeuristicLab.Problems.Instances.DataAnalysis {
    2731  public class TimeSeriesPrognosisCSVInstanceProvider : TimeSeriesPrognosisInstanceProvider {
     
    4852      throw new NotImplementedException();
    4953    }
     54
     55    public override bool CanImportData { get { return true; } }
     56
     57    public override ITimeSeriesPrognosisProblemData ImportData(string path) {
     58      TableFileParser csvFileParser = new TableFileParser();
     59      csvFileParser.Parse(path);
     60
     61      Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
     62      string targetVar = csvFileParser.VariableNames.Last();
     63
     64      IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar));
     65
     66      ITimeSeriesPrognosisProblemData timeSeriesPrognosisData = new TimeSeriesPrognosisProblemData(dataset, allowedInputVars, targetVar);
     67
     68      int trainingPartEnd = csvFileParser.Rows * 2 / 3;
     69      timeSeriesPrognosisData.TrainingPartition.Start = 0;
     70      timeSeriesPrognosisData.TrainingPartition.End = trainingPartEnd;
     71      timeSeriesPrognosisData.TestPartition.Start = trainingPartEnd;
     72      timeSeriesPrognosisData.TestPartition.End = csvFileParser.Rows;
     73
     74      int pos = path.LastIndexOf('\\');
     75      if (pos < 0)
     76        timeSeriesPrognosisData.Name = path;
     77      else {
     78        pos++;
     79        timeSeriesPrognosisData.Name = path.Substring(pos, path.Length - pos);
     80      }
     81      return timeSeriesPrognosisData;
     82    }
     83
     84    protected override ITimeSeriesPrognosisProblemData ImportData(string path, TimeSeriesPrognosisImportType type, TableFileParser csvFileParser) {
     85      Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
     86
     87      // turn of input variables that are constant in the training partition
     88      var allowedInputVars = new List<string>();
     89      int trainingPartEnd = (csvFileParser.Rows * type.Training) / 100;
     90      trainingPartEnd = trainingPartEnd > 0 ? trainingPartEnd : 1;
     91      var trainingIndizes = Enumerable.Range(0, trainingPartEnd);
     92      if (trainingIndizes.Count() >= 2) {
     93        foreach (var variableName in dataset.DoubleVariables) {
     94          if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     95            variableName != type.TargetVariable)
     96            allowedInputVars.Add(variableName);
     97        }
     98      } else {
     99        allowedInputVars.AddRange(dataset.DoubleVariables.Where(x => !x.Equals(type.TargetVariable)));
     100      }
     101
     102      TimeSeriesPrognosisProblemData timeSeriesPrognosisData = new TimeSeriesPrognosisProblemData(dataset, allowedInputVars, type.TargetVariable);
     103
     104      timeSeriesPrognosisData.TrainingPartition.Start = 0;
     105      timeSeriesPrognosisData.TrainingPartition.End = trainingPartEnd;
     106      timeSeriesPrognosisData.TestPartition.Start = trainingPartEnd;
     107      timeSeriesPrognosisData.TestPartition.End = csvFileParser.Rows;
     108
     109      timeSeriesPrognosisData.Name = Path.GetFileName(path);
     110
     111      return timeSeriesPrognosisData;
     112    }
    50113  }
    51114}
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TimeSeries/TimeSeriesPrognosisInstanceProvider.cs

    r8430 r8885  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.IO;
    25 using System.Linq;
    26 using System.Text;
    2722using HeuristicLab.Problems.DataAnalysis;
    2823
    2924namespace HeuristicLab.Problems.Instances.DataAnalysis {
    30   public abstract class TimeSeriesPrognosisInstanceProvider : IProblemInstanceProvider<ITimeSeriesPrognosisProblemData> {
    31     public bool CanImportData { get { return true; } }
    32     public bool CanExportData { get { return true; } }
    33 
    34 
    35     public ITimeSeriesPrognosisProblemData ImportData(string path) {
    36       TableFileParser csvFileParser = new TableFileParser();
    37       csvFileParser.Parse(path);
    38 
    39       Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
    40       string targetVar = csvFileParser.VariableNames.Last();
    41 
    42       IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar));
    43 
    44       ITimeSeriesPrognosisProblemData regData = new TimeSeriesPrognosisProblemData(dataset, allowedInputVars, targetVar);
    45 
    46       int trainingPartEnd = csvFileParser.Rows * 2 / 3;
    47       regData.TrainingPartition.Start = 0;
    48       regData.TrainingPartition.End = trainingPartEnd;
    49       regData.TestPartition.Start = trainingPartEnd;
    50       regData.TestPartition.End = csvFileParser.Rows;
    51 
    52       int pos = path.LastIndexOf('\\');
    53       if (pos < 0)
    54         regData.Name = path;
    55       else {
    56         pos++;
    57         regData.Name = path.Substring(pos, path.Length - pos);
    58       }
    59       return regData;
    60     }
    61 
    62     public void ExportData(ITimeSeriesPrognosisProblemData instance, string path) {
    63       StringBuilder strBuilder = new StringBuilder();
    64 
    65       foreach (var variable in instance.InputVariables) {
    66         strBuilder.Append(variable + ";");
    67       }
    68       strBuilder.Remove(strBuilder.Length - 1, 1);
    69       strBuilder.AppendLine();
    70 
    71       Dataset dataset = instance.Dataset;
    72 
    73       for (int i = 0; i < dataset.Rows; i++) {
    74         for (int j = 0; j < dataset.Columns; j++) {
    75           strBuilder.Append(dataset.GetValue(i, j) + ";");
    76         }
    77         strBuilder.Remove(strBuilder.Length - 1, 1);
    78         strBuilder.AppendLine();
    79       }
    80 
    81       using (StreamWriter writer = new StreamWriter(path)) {
    82         writer.Write(strBuilder);
    83       }
    84     }
    85 
    86     public abstract IEnumerable<IDataDescriptor> GetDataDescriptors();
    87     public abstract ITimeSeriesPrognosisProblemData LoadData(IDataDescriptor descriptor);
    88 
    89     public abstract string Name { get; }
    90     public abstract string Description { get; }
    91     public abstract Uri WebLink { get; }
    92     public abstract string ReferencePublication { get; }
     25  public abstract class TimeSeriesPrognosisInstanceProvider : DataAnalysisInstanceProvider<ITimeSeriesPrognosisProblemData, TimeSeriesPrognosisImportType> {
    9326  }
    9427}
Note: See TracChangeset for help on using the changeset viewer.