Class ParameterTrainer<S extends Observation,T extends Category>

java.lang.Object
org.tweetyproject.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 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 Details

    • ParameterTrainer

      public ParameterTrainer(Trainer<S,T> trainer)
      Creates a new parameter trainer for the given trainer.
      Parameters:
      trainer - some trainer.
  • Method Details

    • 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.
      Specified by:
      train in interface Trainer<S extends Observation,T extends Category>
      Parameters:
      trainingSet - some training set.
      Returns:
      a classifier
    • 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
      Specified by:
      train in interface Trainer<S extends Observation,T extends Category>
      Parameters:
      trainingSet - some training set.
      params - parameters for the training.
      Returns:
      a classifier
    • getParameterSet

      public ParameterSet getParameterSet()
      Description copied from interface: Trainer
      Returns the set of parameters for this trainer.
      Specified by:
      getParameterSet in interface Trainer<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 time train(TrainingSet<S,T> trainingSet) is used it uses these parameters.
      Specified by:
      setParameterSet in interface Trainer<S extends Observation,T extends Category>
      Parameters:
      params - a parameter set.
      Returns:
      true if the operation was successful.