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 ParameterSetgetParameterSet()Returns the set of parameters for this trainer.protected Trainer<S,T>getTrainer()Returns the trainer of this parameter trainer.abstract ParameterSetlearnParameters(TrainingSet<S,T> trainingSet)Learns the best parameters of the given trainer for the training set.booleansetParameterSet(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.Classifiertrain(TrainingSet<S,T> trainingSet)Trains a classifier on the given training set.Classifiertrain(TrainingSet<S,T> trainingSet, ParameterSet params)Trains a classifier on the given training set with the given parameters
-
-
-
Field Detail
-
trainer
private Trainer<S extends Observation,T extends Category> trainer
The trainer for which we seek the best 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:TrainerTrains a classifier on the given training set.
-
train
public Classifier train(TrainingSet<S,T> trainingSet, ParameterSet params)
Description copied from interface:TrainerTrains a classifier on the given training set with the given parameters
-
getParameterSet
public ParameterSet getParameterSet()
Description copied from interface:TrainerReturns the set of parameters for this trainer.- Specified by:
getParameterSetin 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:TrainerSets 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:
setParameterSetin interfaceTrainer<S extends Observation,T extends Category>- Parameters:
params- a parameter set.- Returns:
- true if the operation was successful.
-
-