Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/21/12 11:13:32 (12 years ago)
Author:
sforsten
Message:

#1784: changed the TableFileParser, so that you don't have to determine the file format by yourself. Comments have been added for the different Parse methods.

Location:
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3
Files:
2 edited

Legend:

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

    • Property svn:ignore set to
      Plugin.cs
      obj
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationInstanceProvider.cs

    r7849 r7851  
    2323using System.Collections;
    2424using System.Collections.Generic;
    25 using System.Globalization;
    2625using System.IO;
    2726using System.Linq;
     
    3231  public abstract class ClassificationInstanceProvider : IProblemInstanceProvider<IClassificationProblemData> {
    3332    public IClassificationProblemData LoadData(string path) {
    34       NumberFormatInfo numberFormat;
    35       DateTimeFormatInfo dateFormat;
    36       char separator;
    37       TableFileParser.DetermineFileFormat(new FileStream(path, FileMode.Open), out numberFormat, out dateFormat, out separator);
    38 
    39       IClassificationProblemData claData = LoadData(new FileStream(path, FileMode.Open), numberFormat, dateFormat, separator);
    40       int pos = path.LastIndexOf('\\');
    41       if (pos < 0)
    42         claData.Name = path;
    43       else {
    44         pos++;
    45         claData.Name = path.Substring(pos, path.Length - pos);
    46       }
    47 
    48       return claData;
    49     }
    50 
    51     protected IClassificationProblemData LoadData(Stream stream, NumberFormatInfo numberFormat, DateTimeFormatInfo dateFormat, char separator) {
    5233      TableFileParser csvFileParser = new TableFileParser();
    5334
    54       csvFileParser.Parse(stream, numberFormat, dateFormat, separator);
     35      csvFileParser.Parse(path);
    5536
    5637      Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
     
    6546      claData.TestPartition.Start = trainingPartEnd;
    6647      claData.TestPartition.End = csvFileParser.Rows;
     48      int pos = path.LastIndexOf('\\');
     49      if (pos < 0)
     50        claData.Name = path;
     51      else {
     52        pos++;
     53        claData.Name = path.Substring(pos, path.Length - pos);
     54      }
     55
    6756      return claData;
    6857    }
Note: See TracChangeset for help on using the changeset viewer.