Package net.sf.tweety.machinelearning
Class CrossValidator<S extends Observation,T extends Category>
- java.lang.Object
-
- net.sf.tweety.machinelearning.ClassificationTester<S,T>
-
- net.sf.tweety.machinelearning.CrossValidator<S,T>
-
- Type Parameters:
S
- the type of observationT
- 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
-
Methods inherited from class net.sf.tweety.machinelearning.ClassificationTester
test
-
-
-
-
Method Detail
-
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 classClassificationTester<S extends Observation,T extends Category>
- Parameters:
trainer
- some trainertrainingSet
- some training set- Returns:
- the performance of the trained classifier
-
-