- Timestamp:
- 09/07/12 14:53:39 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs
r8566 r8598 21 21 22 22 using System; 23 using System.Collections; 23 24 using System.Collections.Generic; 24 25 using System.Globalization; … … 87 88 } 88 89 90 public override IClassificationProblemData ImportData(string path, DataAnalysisImportType type) { 91 TableFileParser csvFileParser = new TableFileParser(); 92 csvFileParser.Parse(path); 93 94 List<IList> values = csvFileParser.Values; 95 if (type.Shuffle) { 96 values = Shuffle(values); 97 } 98 99 Dataset dataset = new Dataset(csvFileParser.VariableNames, values); 100 string targetVar = dataset.DoubleVariables.Last(); 101 102 // turn of input variables that are constant in the training partition 103 var allowedInputVars = new List<string>(); 104 var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3); 105 foreach (var variableName in dataset.DoubleVariables) { 106 if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 && 107 variableName != targetVar) 108 allowedInputVars.Add(variableName); 109 } 110 111 ClassificationProblemData classificationData = new ClassificationProblemData(dataset, allowedInputVars, targetVar); 112 113 int trainingPartEnd = trainingIndizes.Last(); 114 classificationData.TrainingPartition.Start = trainingIndizes.First(); 115 classificationData.TrainingPartition.End = trainingPartEnd; 116 classificationData.TestPartition.Start = trainingPartEnd; 117 classificationData.TestPartition.End = csvFileParser.Rows; 118 119 classificationData.Name = Path.GetFileName(path); 120 121 return classificationData; 122 } 123 89 124 public override bool CanExportData { 90 125 get { return true; } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationInstanceProvider.cs
r8192 r8598 23 23 24 24 namespace HeuristicLab.Problems.Instances.DataAnalysis { 25 public abstract class ClassificationInstanceProvider : ProblemInstanceProvider<IClassificationProblemData> {25 public abstract class ClassificationInstanceProvider : DataAnalysisInstanceProvider<IClassificationProblemData> { 26 26 } 27 27 }
Note: See TracChangeset
for help on using the changeset viewer.