Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/22/10 12:14:38 (14 years ago)
Author:
mkommend
Message:

Added logic to remove the test samples from the training samples (ticket #939).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification.Views/3.3/RocCurvesView.cs

    r4417 r4469  
    9797
    9898        int slices = 100;
    99         int samplesStart = Content.ProblemData.TrainingSamplesStart.Value;
    100         int samplesEnd = Content.ProblemData.TrainingSamplesEnd.Value;
     99        IEnumerable<int> rows;
    101100
    102101        if (cmbSamples.SelectedItem.ToString() == TrainingSamples) {
    103           samplesStart = Content.ProblemData.TrainingSamplesStart.Value;
    104           samplesEnd = Content.ProblemData.TrainingSamplesEnd.Value;
     102          rows = Content.ProblemData.TrainingIndizes;
    105103        } else if (cmbSamples.SelectedItem.ToString() == TestSamples) {
    106           samplesStart = Content.ProblemData.TestSamplesStart.Value;
    107           samplesEnd = Content.ProblemData.TestSamplesEnd.Value;
     104          rows = Content.ProblemData.TestIndizes;
    108105        } else throw new InvalidOperationException();
    109106
    110         double[] estimatedValues = Content.EstimatedValues.Skip(samplesStart).Take(samplesEnd - samplesStart).ToArray();
    111         double[] targetClassValues = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable.Value)
    112           .Skip(samplesStart).Take(samplesEnd - samplesStart).ToArray();
     107        double[] estimatedValues = Content.GetEstimatedValues(rows).ToArray();
     108        double[] targetClassValues = Content.ProblemData.Dataset.GetEnumeratedVariableValues(Content.ProblemData.TargetVariable.Value, rows).ToArray();
    113109        double minThreshold = estimatedValues.Min();
    114110        double maxThreshold = estimatedValues.Max();
     
    122118          List<ROCPoint> rocPoints = new List<ROCPoint>();
    123119          int positives = targetClassValues.Where(c => c.IsAlmost(classValue)).Count();
    124           int negatives = samplesEnd - samplesStart - positives;
     120          int negatives = targetClassValues.Length - positives;
    125121
    126122          for (double lowerThreshold = minThreshold; lowerThreshold < maxThreshold; lowerThreshold += thresholdIncrement) {
Note: See TracChangeset for help on using the changeset viewer.