Class CrossValidator<S extends Observation,T extends Category>

java.lang.Object
org.tweetyproject.machinelearning.ClassificationTester<S,T>
org.tweetyproject.machinelearning.CrossValidator<S,T>
Type Parameters:
S - the type of observation
T - the type of category

public class CrossValidator<S extends Observation,T extends Category> extends ClassificationTester<S,T>
Performs cross-validation in a classifier, i.e. it divides a given training set into N parts (more precisely, for each category present in the training set, the observations belonging each category are partitioned into N parts), for each i=1,...,N trains a classifier on the union of all parts except i, and measures the performance on part i. The final performance measure is the average on these N rounds.
Author:
Matthias Thimm
  • Constructor Summary

    Constructors
    Constructor
    Description
    CrossValidator(int fold)
    Creates a new cross-validator with the given number of partitions.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    test(Trainer<S,T> trainer, TrainingSet<S,T> trainingSet)
    This methods takes a trainer and a training set and returns the performance (in [0,1]) of the trained classifier on the training set (e.g.

    Methods inherited from class org.tweetyproject.machinelearning.ClassificationTester

    test

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CrossValidator

      public CrossValidator(int fold)
      Creates a new cross-validator with the given number of partitions.
      Parameters:
      fold - the number of partitions.
  • Method Details

    • test

      public double test(Trainer<S,T> trainer, TrainingSet<S,T> trainingSet)
      Description copied from class: ClassificationTester
      This methods takes a trainer and a training set and returns the performance (in [0,1]) of the trained classifier on the training set (e.g. using cross-validation). The larger the value the better the trained classifier.
      Specified by:
      test in class ClassificationTester<S extends Observation,T extends Category>
      Parameters:
      trainer - some trainer
      trainingSet - some training set
      Returns:
      the performance of the trained classifier