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 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
ConstructorDescriptionCrossValidator
(int fold) Creates a new cross-validator with the given number of partitions. -
Method Summary
Methods inherited from class org.tweetyproject.machinelearning.ClassificationTester
test
-
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
Description copied from class:ClassificationTester
This method takes a trainer and a training set and returns the performance (in the range [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
-