Class ParameterTrainer<S extends Observation,​T extends Category>

  • 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 time train(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
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ParameterTrainer

        public ParameterTrainer​(Trainer<S,​T> trainer)
        Creates a new parameter trainer for the given trainer.
        Parameters:
        trainer - some trainer.
    • 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.
        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
      • 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.