Changeset 8532


Ignore:
Timestamp:
08/28/12 14:59:50 (7 years ago)
Author:
mkommend
Message:

#1820: Refactored and corrected data importer save as problem data functionality and corrected project references.

Location:
branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DataProcessor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DataProcessor/DataProcessorView.cs

    r7868 r8532  
    386386          DataAnalysisProblemData problemData = null;
    387387          if (saveFileDialog.FilterIndex == 1) {
    388             problemData = new RegressionProblemData(dataset, dataset.VariableNames, dataset.VariableNames.First());
     388            problemData = new RegressionProblemData(dataset, dataset.DoubleVariables, dataset.DoubleVariables.First());
    389389          } else if (saveFileDialog.FilterIndex == 2) {
    390             problemData = new ClassificationProblemData(dataset, dataset.VariableNames, dataset.VariableNames.First());
     390            problemData = new ClassificationProblemData(dataset, dataset.DoubleVariables, dataset.DoubleVariables.First());
    391391          } else {
    392392            throw new ArgumentException("File extension doesn't exist");
     
    401401    private Dataset ConvertDataset(DataSet dataSet) {
    402402      ColumnGroup cg;
    403       if (dataSet.ActiveColumnGroups.Count() > 0) {
     403      if (dataSet.ActiveColumnGroups.Any()) {
    404404        cg = dataSet.ActiveColumnGroups.First();
    405       } else if (dataSet.ColumnGroups.Count() > 0) {
     405      } else if (dataSet.ColumnGroups.Any()) {
    406406        cg = dataSet.ColumnGroups.First();
    407407      } else {
     
    410410      List<IList> values = new List<IList>();
    411411      foreach (var column in cg.Columns) {
    412         if (column.DataType.Equals(typeof(double?))) {
    413           values.Add(column.ValuesEnumerable.Cast<double?>().Select(x => x == null ? double.NaN : x).Cast<double>().ToList());
    414         } else if (column.DataType.Equals(typeof(string))) {
    415           values.Add(column.ValuesEnumerable.Cast<string>().ToList());
    416         } else if (column.DataType.Equals(typeof(DateTime?))) {
    417           values.Add(column.ValuesEnumerable.Cast<DateTime?>().Select(x => x == null ? new DateTime() : x).Cast<DateTime>().ToList());
     412        if (column.DataType == typeof(double?)) {
     413          values.Add(column.ValuesEnumerable.Cast<double?>().Select(x => x ?? double.NaN).ToList());
     414        } else if (column.DataType == typeof(string)) {
     415          values.Add(column.ValuesEnumerable.Cast<string>().Select(x => x ?? string.Empty).ToList());
     416        } else if (column.DataType == typeof(DateTime?)) {
     417          values.Add(column.ValuesEnumerable.Cast<DateTime?>().Select(x => x ?? default(DateTime)).ToList());
    418418        } else {
    419419          throw new ArgumentException("The variable values must be of type List<double>, List<string> or List<DateTime>");
  • branches/HeuristicLab.DataImporter/HeuristicLab.DataImporter.DataProcessor/HeuristicLab.DataImporter.DataProcessor.csproj

    r7868 r8532  
    9494  </PropertyGroup>
    9595  <ItemGroup>
    96     <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     96    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     97      <Private>False</Private>
     98    </Reference>
    9799    <Reference Include="HeuristicLab.Common.Resources-3.3">
    98100      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
    99101      <Private>False</Private>
    100102    </Reference>
    101     <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    102     <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     103    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     104      <Private>False</Private>
     105    </Reference>
     106    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     107      <Private>False</Private>
     108    </Reference>
    103109    <Reference Include="HeuristicLab.Persistence-3.3">
    104110      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     
    109115      <Private>False</Private>
    110116    </Reference>
    111     <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     117    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     118      <Private>False</Private>
     119    </Reference>
    112120    <Reference Include="System" />
    113121    <Reference Include="System.Core">
Note: See TracChangeset for help on using the changeset viewer.