de.jstacs.classifiers
Class ClassifierFactory

java.lang.Object
  extended by de.jstacs.classifiers.ClassifierFactory

public class ClassifierFactory
extends Object

This class allows to easily create classifiers from TrainableStatisticalModels, DifferentiableStatisticalModels, and DifferentiableSequenceScores. Most parameters of the classifiers are set to default values. If you like to set some of these additional parameters to non-standard values, directly use the constructors of TrainSMBasedClassifier, GenDisMixClassifier, or MSPClassifier.

Author:
Jan Grau

Constructor Summary
ClassifierFactory()
           
 
Method Summary
static AbstractClassifier createClassifier(DifferentiableSequenceScore... models)
          Creates a classifier that is based on at least two DifferentiableSequenceScores.
static AbstractClassifier createClassifier(double[] beta, DifferentiableStatisticalModel... models)
          Creates a classifier that is based on at least two DifferentiableStatisticalModels.
static AbstractClassifier createClassifier(LearningPrinciple principle, DifferentiableStatisticalModel... models)
          Creates a classifier that is based on at least two DifferentiableStatisticalModels.
static AbstractClassifier createGenerativeClassifier(TrainableStatisticalModel... models)
          Creates a classifier that is based on at least two TrainableStatisticalModels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassifierFactory

public ClassifierFactory()
Method Detail

createGenerativeClassifier

public static AbstractClassifier createGenerativeClassifier(TrainableStatisticalModel... models)
                                                     throws IllegalArgumentException,
                                                            CloneNotSupportedException,
                                                            ClassDimensionException
Creates a classifier that is based on at least two TrainableStatisticalModels. Such models can be created using the TrainableStatisticalModelFactory or by directly using constructors of sub-classes of TrainableStatisticalModel. After the classifier has been created, it can be trained using the AbstractClassifier.train(de.jstacs.data.DataSet...) method using one data set for each TrainableStatisticalModel provided.

Parameters:
models - the models for the individual classes
Returns:
the classifier
Throws:
IllegalArgumentException - if the TrainableStatisticalModels do not describe a common domain of sequences
CloneNotSupportedException - if at least one TrainableStatisticalModel could not be cloned
ClassDimensionException - if the number of classes is below 2

createClassifier

public static AbstractClassifier createClassifier(LearningPrinciple principle,
                                                  DifferentiableStatisticalModel... models)
                                           throws IllegalArgumentException,
                                                  Exception
Creates a classifier that is based on at least two DifferentiableStatisticalModels. Such models can be created using the DifferentiableStatisticalModelFactory or by directly using constructors of sub-classes of DifferentiableStatisticalModel. After the classifier has been created, it can be trained using the AbstractClassifier.train(de.jstacs.data.DataSet...) method using one data set for each DifferentiableStatisticalModel provided. The LearningPrinciple (generative ML or MAP, or discriminative MCL or MSP) must be provided as first parameter.

Parameters:
principle - the learning principle
models - the models for the individual classes
Returns:
the classifier
Throws:
IllegalArgumentException - if the lengths of the DifferentiableStatisticalModels (see SequenceScore.getLength()) are incompatible
Exception - if something else went wrong

createClassifier

public static AbstractClassifier createClassifier(double[] beta,
                                                  DifferentiableStatisticalModel... models)
                                           throws IllegalArgumentException,
                                                  Exception
Creates a classifier that is based on at least two DifferentiableStatisticalModels. Such models can be created using the DifferentiableStatisticalModelFactory or by directly using constructors of sub-classes of DifferentiableStatisticalModel. After the classifier has been created, it can be trained using the AbstractClassifier.train(de.jstacs.data.DataSet...) method using one data set for each DifferentiableStatisticalModel provided. The beta array determines the employed learning principle and must be provided as first parameter.

Parameters:
beta - an array specifying the learning principle by weighting factors for conditional likelihood, likelihood and prior
models - the models for the individual classes
Returns:
the classifier
Throws:
IllegalArgumentException - if the lengths of the DifferentiableStatisticalModels (see SequenceScore.getLength()) are incompatible
Exception - if something else went wrong
See Also:
LearningPrinciple, LogGenDisMixFunction

createClassifier

public static AbstractClassifier createClassifier(DifferentiableSequenceScore... models)
                                           throws IllegalArgumentException,
                                                  Exception
Creates a classifier that is based on at least two DifferentiableSequenceScores. Such scores can be created using the DifferentiableStatisticalModelFactory (since DifferentiableStatisticalModels are also DifferentiableSequenceScores) or by directly using constructors of sub-classes of DifferentiableSequenceScore. After the classifier has been created, it can be trained using the discriminative MCL principle using the AbstractClassifier.train(de.jstacs.data.DataSet...) method using one data set for each DifferentiableSequenceScore provided.

Parameters:
models - the models for the individual classes
Returns:
the classifier
Throws:
IllegalArgumentException - if the lengths of the DifferentiableSequenceScores (see SequenceScore.getLength()) are incompatible
Exception - if something else went wrong