Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11537


Ignore:
Timestamp:
11/11/14 12:56:55 (9 years ago)
Author:
mkommend
Message:

#2245: Merged r11380, r11381 & r11403 into stable.

Location:
stable
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ManipulationView.Designer.cs

    r10977 r11537  
    4949      this.label10 = new System.Windows.Forms.Label();
    5050      this.tabDataShuffle = new System.Windows.Forms.TabPage();
    51       this.label6 = new System.Windows.Forms.Label();
     51      this.lblShuffleProperties = new System.Windows.Forms.Label();
    5252      this.grpBoxPreview = new System.Windows.Forms.GroupBox();
    5353      this.tabsPreview = new System.Windows.Forms.TabControl();
     
    6666      this.lblPreviewShuffle = new System.Windows.Forms.Label();
    6767      this.label9 = new System.Windows.Forms.Label();
     68      this.shuffleSeparatelyCheckbox = new System.Windows.Forms.CheckBox();
    6869      this.grpBoxData.SuspendLayout();
    6970      this.tabsData.SuspendLayout();
     
    350351      // tabDataShuffle
    351352      //
    352       this.tabDataShuffle.Controls.Add(this.label6);
     353      this.tabDataShuffle.Controls.Add(this.shuffleSeparatelyCheckbox);
     354      this.tabDataShuffle.Controls.Add(this.lblShuffleProperties);
    353355      this.tabDataShuffle.Location = new System.Drawing.Point(4, 22);
    354356      this.tabDataShuffle.Name = "tabDataShuffle";
     
    359361      this.tabDataShuffle.UseVisualStyleBackColor = true;
    360362      //
    361       // label6
    362       //
    363       this.label6.AutoSize = true;
    364       this.label6.Enabled = false;
    365       this.label6.Location = new System.Drawing.Point(3, 3);
    366       this.label6.Name = "label6";
    367       this.label6.Size = new System.Drawing.Size(115, 13);
    368       this.label6.TabIndex = 0;
    369       this.label6.Text = "No properties available";
     363      // lblShuffleProperties
     364      //
     365      this.lblShuffleProperties.AutoSize = true;
     366      this.lblShuffleProperties.Enabled = false;
     367      this.lblShuffleProperties.Location = new System.Drawing.Point(3, 3);
     368      this.lblShuffleProperties.Name = "lblShuffleProperties";
     369      this.lblShuffleProperties.Size = new System.Drawing.Size(115, 13);
     370      this.lblShuffleProperties.TabIndex = 0;
     371      this.lblShuffleProperties.Text = "No properties available";
    370372      //
    371373      // grpBoxPreview
     
    536538      this.label9.Size = new System.Drawing.Size(100, 23);
    537539      this.label9.TabIndex = 0;
     540      //
     541      // shuffleSeparatelyCheckbox
     542      //
     543      this.shuffleSeparatelyCheckbox.AutoSize = true;
     544      this.shuffleSeparatelyCheckbox.Location = new System.Drawing.Point(6, 2);
     545      this.shuffleSeparatelyCheckbox.Name = "shuffleSeparatelyCheckbox";
     546      this.shuffleSeparatelyCheckbox.Size = new System.Drawing.Size(233, 17);
     547      this.shuffleSeparatelyCheckbox.TabIndex = 1;
     548      this.shuffleSeparatelyCheckbox.Text = "Shuffle training and test partitions separately";
     549      this.shuffleSeparatelyCheckbox.UseVisualStyleBackColor = true;
    538550      //
    539551      // ManipulationView
     
    619631    private System.Windows.Forms.Label label10;
    620632    private System.Windows.Forms.TabPage tabDataShuffle;
    621     private System.Windows.Forms.Label label6;
     633    private System.Windows.Forms.Label lblShuffleProperties;
    622634    private System.Windows.Forms.ComboBox cmbVariableNames;
    623635    private System.Windows.Forms.Label label8;
    624636    private System.Windows.Forms.Label lblPreviewInActive;
     637    private System.Windows.Forms.CheckBox shuffleSeparatelyCheckbox;
    625638  }
    626639}
  • stable/HeuristicLab.DataPreprocessing.Views/3.4/ManipulationView.cs

    r11170 r11537  
    5151        ()=>validateDeleteRowsInfo(),
    5252        ()=>validateReplaceWith(),
    53         ()=>{btnApply.Enabled = true; lblPreviewShuffle.Text = "Data will be shuffled randomly - preview not possible";} //shuffle
     53        ()=>validateShuffle()
    5454      };
    5555
     
    5959        ()=>Content.ManipulationLogic.DeleteRowsWithMissingValuesGreater(getRowsColumnsInfo()),
    6060        ()=>replaceMissingValues(),
    61         ()=>Content.ManipulationLogic.ShuffleWithRanges()
     61        ()=>Content.ManipulationLogic.Shuffle(shuffleSeparatelyCheckbox.Checked)
    6262      };
    63 
    6463    }
    6564
     
    228227    }
    229228
     229    private void validateShuffle() {
     230      btnApply.Enabled = true;
     231      lblShuffleProperties.Enabled = false;
     232      lblShuffleProperties.Visible = false;
     233      shuffleSeparatelyCheckbox.Enabled = true;
     234      shuffleSeparatelyCheckbox.Visible = true;
     235    }
     236
    230237    public new ManipulationContent Content {
    231238      get { return (ManipulationContent)base.Content; }
  • stable/HeuristicLab.DataPreprocessing/3.4/Implementations/ManipulationContent.cs

    r11170 r11537  
    4141    }
    4242
    43     public ManipulationContent(IManipulationLogic theManipulationLogic, ISearchLogic theSearchLogic, IFilterLogic theFitlerLogic) {
     43    public ManipulationContent(IManipulationLogic theManipulationLogic, ISearchLogic theSearchLogic, IFilterLogic theFilterLogic) {
    4444      manipulationLogic = theManipulationLogic;
    4545      searchLogic = theSearchLogic;
    46       filterLogic = theFitlerLogic;
     46      filterLogic = theFilterLogic;
    4747    }
    4848
  • stable/HeuristicLab.DataPreprocessing/3.4/Implementations/ManipulationLogic.cs

    r11170 r11537  
    225225    }
    226226
    227     public void ShuffleWithRanges() {
    228       ShuffleWithRanges(new[] {
    229         preprocessingData.TestPartition,
    230         preprocessingData.TrainingPartition
    231       });
    232     }
    233 
    234     public void ShuffleWithRanges(IEnumerable<IntRange> ranges) {
    235       // init random outside loop
     227    public void Shuffle(bool shuffleRangesSeparately) {
    236228      Random random = new Random();
    237 
    238       preprocessingData.InTransaction(() => {
    239         // process all given ranges - e.g. TrainingPartition, TestPartition
    240         foreach (IntRange range in ranges) {
    241           List<Tuple<int, int>> shuffledIndices = new List<Tuple<int, int>>();
    242 
    243           // generate random indices used for shuffeling each column
    244           for (int i = range.End - 1; i >= range.Start; --i) {
    245             int rand = random.Next(range.Start, i);
    246             shuffledIndices.Add(new Tuple<int, int>(i, rand));
    247           }
    248 
    249           ShuffleToIndices(shuffledIndices);
    250         }
    251       });
     229      var ranges = new[] { preprocessingData.TestPartition, preprocessingData.TrainingPartition };
     230      if (shuffleRangesSeparately) {
     231        preprocessingData.InTransaction(() => {
     232          // process all given ranges - e.g. TrainingPartition, TestPartition
     233          foreach (IntRange range in ranges) {
     234            List<Tuple<int, int>> shuffledIndices = new List<Tuple<int, int>>();
     235
     236            // generate random indices used for shuffeling each column
     237            for (int i = range.End - 1; i >= range.Start; --i) {
     238              int rand = random.Next(range.Start, i);
     239              shuffledIndices.Add(new Tuple<int, int>(i, rand));
     240            }
     241
     242            ShuffleToIndices(shuffledIndices);
     243          }
     244        });
     245      } else {
     246        preprocessingData.InTransaction(() => {
     247          var indices = ranges.SelectMany(x => Enumerable.Range(x.Start, x.Size)).ToList();
     248          var shuffledIndices = indices.OrderBy(x => random.Next());
     249          ShuffleToIndices(indices.Zip(shuffledIndices, (i, j) => new Tuple<int, int>(i, j)).ToList());
     250        });
     251      }
    252252    }
    253253
  • stable/HeuristicLab.DataPreprocessing/3.4/Interfaces/IManipulationLogic.cs

    r11170 r11537  
    3838    void ReplaceIndicesByValue(IDictionary<int, IList<int>> cells, string value);
    3939    void ReplaceIndicesByValue<T>(int columnIndex, IEnumerable<int> rowIndices, T value);
    40     void ShuffleWithRanges();
    41     void ShuffleWithRanges(IEnumerable<HeuristicLab.Data.IntRange> ranges);
     40    void Shuffle(bool shuffleRangesSeparately);
    4241    List<int> RowsWithMissingValuesGreater(double percent);
    4342    List<int> ColumnsWithMissingValuesGreater(double percent);
Note: See TracChangeset for help on using the changeset viewer.