Changeset 7851 for trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationInstanceProvider.cs
- Timestamp:
- 05/21/12 11:13:32 (12 years ago)
- 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
-
Property
svn:ignore
set to
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationInstanceProvider.cs
r7849 r7851 23 23 using System.Collections; 24 24 using System.Collections.Generic; 25 using System.Globalization;26 25 using System.IO; 27 26 using System.Linq; … … 32 31 public abstract class ClassificationInstanceProvider : IProblemInstanceProvider<IClassificationProblemData> { 33 32 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) {52 33 TableFileParser csvFileParser = new TableFileParser(); 53 34 54 csvFileParser.Parse( stream, numberFormat, dateFormat, separator);35 csvFileParser.Parse(path); 55 36 56 37 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); … … 65 46 claData.TestPartition.Start = trainingPartEnd; 66 47 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 67 56 return claData; 68 57 }
Note: See TracChangeset
for help on using the changeset viewer.