T
- samples datatypepublic class RandomSplitCrossValidation<T> extends java.lang.Object implements CrossValidation
Class for simple random split based cross validation. The list of samples is split random into training and validation sets (using the trainPercent parameter). nbTest evaluation are performed.
By default, 70% of the samples are used for training, and 20 tests are performed
Constructor and Description |
---|
RandomSplitCrossValidation(Classifier<T> cls,
java.util.List<TrainingSample<T>> l,
Evaluator<T> e)
Default constructor which should provide a classifier to be tested,
the complete list of samples and the evaluator computing the scores
|
Modifier and Type | Method and Description |
---|---|
double |
getAverageScore()
Tells the average score of the test
|
Classifier<T> |
getClassifier()
Tells the classifier
|
java.util.List<TrainingSample<T>> |
getList()
Tells the list of samples
|
int |
getNbTest()
Tells the number of tests performed
|
double[] |
getScores()
Tells the scores of the tests, in order of evaluation
|
long |
getSeed() |
double |
getStdDevScore()
Tells the standard deviation of the test
|
double |
getTrainPercent()
Tells the percentage of samples used for training
|
void |
run()
perform learning and evaluations
|
void |
setClassifier(Classifier<T> classifier)
Sets the classifier
|
void |
setList(java.util.List<TrainingSample<T>> list)
Sets the list of samples
|
void |
setNbTest(int nbTest)
Sets the number of tests to perfom
|
void |
setSeed(long seed) |
void |
setTrainPercent(double trainPercent)
Sets the percentage of samples used for training
|
public RandomSplitCrossValidation(Classifier<T> cls, java.util.List<TrainingSample<T>> l, Evaluator<T> e)
cls
- the classifier to be trained and testedl
- the list of available samplese
- the evaluator used for the scorepublic void run()
CrossValidation
run
in interface CrossValidation
public double getAverageScore()
CrossValidation
getAverageScore
in interface CrossValidation
public double getStdDevScore()
CrossValidation
getStdDevScore
in interface CrossValidation
public double[] getScores()
CrossValidation
getScores
in interface CrossValidation
public Classifier<T> getClassifier()
public void setClassifier(Classifier<T> classifier)
classifier
- the classifier used in the testspublic java.util.List<TrainingSample<T>> getList()
public void setList(java.util.List<TrainingSample<T>> list)
list
- the list of samples to be used in the testspublic double getTrainPercent()
public void setTrainPercent(double trainPercent)
trainPercent
- the percent of available samples to keep for trainingpublic int getNbTest()
public void setNbTest(int nbTest)
nbTest
- the number of tests to performpublic long getSeed()
public void setSeed(long seed)