Package net.sf.tweety.machinelearning
Class ParameterTrainer<S extends Observation,T extends Category>
- java.lang.Object
-
- net.sf.tweety.machinelearning.ParameterTrainer<S,T>
-
- Type Parameters:
S
- The type of observations.T
- The type of categories.
- All Implemented Interfaces:
Trainer<S,T>
- Direct Known Subclasses:
GridSearchParameterLearner
public abstract class ParameterTrainer<S extends Observation,T extends Category> extends java.lang.Object implements Trainer<S,T>
Performs a parameter training on a given trainer, i.e. explores the space of the parameters to obtain the best parameters for training.- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description ParameterTrainer(Trainer<S,T> trainer)
Creates a new parameter trainer for the given trainer.
-
Method Summary
Modifier and Type Method Description ParameterSet
getParameterSet()
Returns the set of parameters for this trainer.abstract ParameterSet
learnParameters(TrainingSet<S,T> trainingSet)
Learns the best parameters of the given trainer for the training set.boolean
setParameterSet(ParameterSet params)
Sets the parameters for this trainer (calling this method must ensure that the next timetrain(TrainingSet<S,T> trainingSet)
is used it uses these parameters.Classifier
train(TrainingSet<S,T> trainingSet)
Trains a classifier on the given training set.Classifier
train(TrainingSet<S,T> trainingSet, ParameterSet params)
Trains a classifier on the given training set with the given parameters
-
-
-
Method Detail
-
learnParameters
public abstract ParameterSet learnParameters(TrainingSet<S,T> trainingSet)
Learns the best parameters of the given trainer for the training set.- Parameters:
trainingSet
- a training set- Returns:
- the best parameters for the training set.
-
train
public Classifier train(TrainingSet<S,T> trainingSet)
Description copied from interface:Trainer
Trains a classifier on the given training set.
-
train
public Classifier train(TrainingSet<S,T> trainingSet, ParameterSet params)
Description copied from interface:Trainer
Trains a classifier on the given training set with the given parameters
-
getParameterSet
public ParameterSet getParameterSet()
Description copied from interface:Trainer
Returns the set of parameters for this trainer.- Specified by:
getParameterSet
in interfaceTrainer<S extends Observation,T extends Category>
- Returns:
- the set of parameters for this trainer.
-
setParameterSet
public boolean setParameterSet(ParameterSet params)
Description copied from interface:Trainer
Sets the parameters for this trainer (calling this method must ensure that the next timetrain(TrainingSet<S,T> trainingSet)
is used it uses these parameters.- Specified by:
setParameterSet
in interfaceTrainer<S extends Observation,T extends Category>
- Parameters:
params
- a parameter set.- Returns:
- true if the operation was successful.
-
-