Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/07/12 16:01:26 (12 years ago)
Author:
sforsten
Message:

#1942: Training and test partition can be defined (with a TrackBar in percent), when importing a csv file for data analysis problems.

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

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs

    r8598 r8599  
    7070      var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
    7171      foreach (var variableName in dataset.DoubleVariables) {
    72         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     72        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    7373          variableName != targetVar)
    7474          allowedInputVars.Add(variableName);
     
    102102      // turn of input variables that are constant in the training partition
    103103      var allowedInputVars = new List<string>();
    104       var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
     104      int trainingPartEnd = (csvFileParser.Rows * type.Training) / 100;
     105      var trainingIndizes = Enumerable.Range(0, trainingPartEnd);
    105106      foreach (var variableName in dataset.DoubleVariables) {
    106         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     107        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    107108          variableName != targetVar)
    108109          allowedInputVars.Add(variableName);
     
    111112      ClassificationProblemData classificationData = new ClassificationProblemData(dataset, allowedInputVars, targetVar);
    112113
    113       int trainingPartEnd = trainingIndizes.Last();
    114       classificationData.TrainingPartition.Start = trainingIndizes.First();
     114      classificationData.TrainingPartition.Start = 0;
    115115      classificationData.TrainingPartition.End = trainingPartEnd;
    116116      classificationData.TestPartition.Start = trainingPartEnd;
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Clustering/CSV/ClusteringCSVInstanceProvider.cs

    r8598 r8599  
    6969      var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
    7070      foreach (var variableName in dataset.DoubleVariables) {
    71         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     71        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    7272          variableName != targetVar)
    7373          allowedInputVars.Add(variableName);
     
    101101      // turn of input variables that are constant in the training partition
    102102      var allowedInputVars = new List<string>();
    103       var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
     103      int trainingPartEnd = (csvFileParser.Rows * type.Training) / 100;
     104      var trainingIndizes = Enumerable.Range(0, trainingPartEnd);
    104105      foreach (var variableName in dataset.DoubleVariables) {
    105         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     106        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    106107          variableName != targetVar)
    107108          allowedInputVars.Add(variableName);
     
    110111      ClusteringProblemData clusteringData = new ClusteringProblemData(dataset, allowedInputVars);
    111112
    112       int trainingPartEnd = trainingIndizes.Last();
    113       clusteringData.TrainingPartition.Start = trainingIndizes.First();
     113      clusteringData.TrainingPartition.Start = 0;
    114114      clusteringData.TrainingPartition.End = trainingPartEnd;
    115115      clusteringData.TestPartition.Start = trainingPartEnd;
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/CSV/RegressionCSVInstanceProvider.cs

    r8598 r8599  
    6868      var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
    6969      foreach (var variableName in dataset.DoubleVariables) {
    70         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     70        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    7171          variableName != targetVar)
    7272          allowedInputVars.Add(variableName);
     
    9999      // turn of input variables that are constant in the training partition
    100100      var allowedInputVars = new List<string>();
    101       var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
     101      int trainingPartEnd = (csvFileParser.Rows * type.Training) / 100;
     102      var trainingIndizes = Enumerable.Range(0, trainingPartEnd);
    102103      foreach (var variableName in dataset.DoubleVariables) {
    103         if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
     104        if (trainingIndizes.Count() >= 2 && dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
    104105          variableName != targetVar)
    105106          allowedInputVars.Add(variableName);
     
    108109      RegressionProblemData regressionData = new RegressionProblemData(dataset, allowedInputVars, targetVar);
    109110
    110       int trainingPartEnd = trainingIndizes.Last();
    111       regressionData.TrainingPartition.Start = trainingIndizes.First();
     111      regressionData.TrainingPartition.Start = 0;
    112112      regressionData.TrainingPartition.End = trainingPartEnd;
    113113      regressionData.TestPartition.Start = trainingPartEnd;
Note: See TracChangeset for help on using the changeset viewer.