Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/08/14 15:33:08 (11 years ago)
Author:
tsteinre
Message:
  • Created PreprocessingCloner
  • Implemented Export Problem Logic
Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj

    r10303 r10310  
    9494    <Compile Include="Interfaces\ILineChartLogic.cs" />
    9595    <Compile Include="Interfaces\ITransformationLogic.cs" />
     96    <Compile Include="PreprocessingCloner.cs" />
    9697    <Compile Include="Views\FilterView.cs">
    9798      <SubType>UserControl</SubType>
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataPreprocessingView.cs

    r10307 r10310  
    11using System;
    22using System.Collections.Generic;
    3 using System.Linq;
    43using System.Windows.Forms;
    54using HeuristicLab.Common;
    65using HeuristicLab.Core;
    76using HeuristicLab.Core.Views;
    8 using HeuristicLab.Data;
    97using HeuristicLab.MainForm;
    10 using HeuristicLab.Optimization;
    11 using HeuristicLab.Problems.DataAnalysis;
    128
    139namespace HeuristicLab.DataPreprocessing {
     
    2521    private Dictionary<ListViewItem, IItem> listViewItemItemMapping;
    2622
    27 
    2823    public DataPreprocessingView() {
    2924      InitializeComponent();
    3025    }
    31 
    3226
    3327    protected override void OnContentChanged() {
     
    10599
    106100    private void exportProblemButton_Click(object sender, EventArgs e) {
     101      var cloner = new PreprocessingCloner(Content);
     102      var alteredClone = cloner.GenerateAlteredClone(Content.Problem);
     103
    107104      var saveFileDialog = new SaveFileDialog {
    108105        Title = "Save Item",
     
    112109      };
    113110
    114       var content = Content.Problem as IStorableContent;
     111      var content = alteredClone as IStorableContent;
    115112      if (saveFileDialog.ShowDialog() == DialogResult.OK) {
    116113        bool compressed = saveFileDialog.FilterIndex != 1;
     
    120117
    121118    private void applyInNewTabButton_Click(object sender, EventArgs e) {
    122       IPreprocessingData Data = Content.Data;
     119      IPreprocessingData data = Content.Data;
    123120
    124       foreach (string variable in Data.VariableNames) {
    125         for (int j = 0; j < Data.Rows; j++) {
     121      foreach (string variable in data.VariableNames) {
     122        for (int j = 0; j < data.Rows; j++) {
    126123          // assume: all double
    127           Data.SetCell(variable, j, 1.0);
     124          data.SetCell(variable, j, 1.0);
    128125        }
    129126      }
    130 
    131127      MessageBox.Show("Success, now cloning... ");
    132128
    133       Dataset dataset = Data.ExportToDataset();
    134       var variables = new CheckedItemList<StringValue>(Data.VariableNames.Select(s => new StringValue(s))).AsReadOnly();
    135 
    136       var cloner = new Cloner();
    137 
    138       cloner.RegisterClonedObject(Content.DataAnalysisProblemData.Dataset, dataset);
    139       cloner.RegisterClonedObject(Content.DataAnalysisProblemData.TrainingPartition, Data.TrainingPartition);
    140       cloner.RegisterClonedObject(Content.DataAnalysisProblemData.TestPartition, Data.TestPartition);
    141       cloner.RegisterClonedObject(Content.DataAnalysisProblemData.InputVariables, variables);
    142       if (Content.Algorithm != null) {
    143         cloner.RegisterClonedObject(Content.Algorithm.Runs, new RunCollection { OptimizerName = Content.Algorithm.Name });
    144       }
    145 
    146       var item = cloner.Clone(Content.ParentItem);
     129      var cloner = new PreprocessingCloner(Content);
     130      var item = cloner.GenerateAlteredClone(Content.ParentItem);
    147131
    148132      MainFormManager.MainForm.ShowContent(item);
    149133    }
    150 
    151134  }
    152135}
    153 
Note: See TracChangeset for help on using the changeset viewer.