|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.classifiers.AbstractClassifier
de.jstacs.classifiers.AbstractScoreBasedClassifier
de.jstacs.classifiers.differentiableSequenceScoreBased.ScoreClassifier
de.jstacs.classifiers.differentiableSequenceScoreBased.gendismix.GenDisMixClassifier
public class GenDisMixClassifier
This class implements a classifier the optimizes the following function
LearningPrinciple
,
LogGenDisMixFunction
Nested Class Summary |
---|
Nested classes/interfaces inherited from class de.jstacs.classifiers.AbstractScoreBasedClassifier |
---|
AbstractScoreBasedClassifier.DoubleTableResult |
Field Summary | |
---|---|
protected double[] |
beta
The weights that determine a point of the simplex that corresponds to the function that is optimized by this classifier. |
protected LogGenDisMixFunction |
function
The function that is optimized in this classifier. |
protected LogPrior |
prior
The prior that is used in this classifier. |
Fields inherited from class de.jstacs.classifiers.differentiableSequenceScoreBased.ScoreClassifier |
---|
hasBeenOptimized, NOT_TRAINED_VALUE, params, score, sostream, template |
Constructor Summary | |
---|---|
|
GenDisMixClassifier(GenDisMixClassifierParameterSet params,
LogPrior prior,
double[] beta,
DifferentiableStatisticalModel... score)
The main constructor. |
protected |
GenDisMixClassifier(GenDisMixClassifierParameterSet params,
LogPrior prior,
double lastScore,
double[] beta,
DifferentiableSequenceScore... score)
This constructor creates an instance and sets the value of the last (external) optimization. |
|
GenDisMixClassifier(GenDisMixClassifierParameterSet params,
LogPrior prior,
double lastScore,
double[] beta,
DifferentiableStatisticalModel... score)
This constructor creates an instance and sets the value of the last (external) optimization. |
|
GenDisMixClassifier(GenDisMixClassifierParameterSet params,
LogPrior prior,
double genBeta,
double disBeta,
double priorBeta,
DifferentiableStatisticalModel... score)
This convenience constructor agglomerates the genBeta, disBeta, and priorBeta into an array and calls the main constructor. |
|
GenDisMixClassifier(GenDisMixClassifierParameterSet params,
LogPrior prior,
LearningPrinciple key,
DifferentiableStatisticalModel... score)
This convenience constructor creates an array of weights for an elementary learning principle and calls the main constructor. |
|
GenDisMixClassifier(StringBuffer xml)
This is the constructor for Storable . |
Method Summary | |
---|---|
GenDisMixClassifier |
clone()
|
static GenDisMixClassifier[] |
create(GenDisMixClassifierParameterSet params,
LogPrior prior,
double[] weights,
DifferentiableStatisticalModel[]... functions)
This method creates an array of GenDisMixClassifiers by using the cross-product of the given DifferentiableStatisticalModel s. |
protected void |
extractFurtherClassifierInfosFromXML(StringBuffer xml)
Extracts further information of a classifier from an XML representation. |
protected LogGenDisMixFunction |
getFunction(DataSet[] data,
double[][] weights)
Returns the function that should be optimized. |
protected StringBuffer |
getFurtherClassifierInfos()
This method returns further information of a classifier as a StringBuffer . |
String |
getInstanceName()
Returns a short description of the classifier. |
int |
getNumberOfThreads()
This method returns the number of used threads while optimization. |
protected String |
getXMLTag()
Returns the String that is used as tag for the XML representation
of the classifier. |
void |
setNumberOfThreads(int threads)
This method allows to set the number of threads used while optimization. |
void |
setPrior(LogPrior prior)
This method set a new prior that should be used for optimization. |
void |
setWeights(double... beta)
This method set the weights for the summand of the function. |
String |
toString()
|
Methods inherited from class de.jstacs.classifiers.differentiableSequenceScoreBased.ScoreClassifier |
---|
createStructure, createStructure, doOptimization, getClassifierAnnotation, getCurrentParameterSet, getDifferentiableSequenceScore, getDifferentiableSequenceScores, getLastScore, getNumericalCharacteristics, getScore, hasBeenOptimized, initUsingParameters, isInitialized, preoptimize, setOutputStream, train |
Methods inherited from class de.jstacs.classifiers.AbstractScoreBasedClassifier |
---|
check, check, classify, classify, createDefaultClassWeights, getClassWeight, getClassWeights, getMultiClassScores, getNumberOfClasses, getPValue, getPValue, getResults, getScore, getScores, setClassWeights, setClassWeights, setThresholdClassWeights |
Methods inherited from class de.jstacs.classifiers.AbstractClassifier |
---|
classify, evaluate, getAlphabetContainer, getCharacteristics, getLength, toXML, train |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected LogPrior prior
protected LogGenDisMixFunction function
protected double[] beta
Constructor Detail |
---|
protected GenDisMixClassifier(GenDisMixClassifierParameterSet params, LogPrior prior, double lastScore, double[] beta, DifferentiableSequenceScore... score) throws CloneNotSupportedException
params
- the common parametersprior
- the prior for the parameters of the classifierlastScore
- the score of the last optimizationbeta
- the weights for log likelihood, log conditional likelihood and log priorscore
- the functions for the classes
CloneNotSupportedException
- if an instance could not be clonepublic GenDisMixClassifier(GenDisMixClassifierParameterSet params, LogPrior prior, double lastScore, double[] beta, DifferentiableStatisticalModel... score) throws CloneNotSupportedException
params
- the common parametersprior
- the prior for the parameters of the classifierlastScore
- the score of the last optimizationbeta
- the weights for log likelihood, log conditional likelihood and log priorscore
- the functions for the classes
CloneNotSupportedException
- if an instance could not be clonepublic GenDisMixClassifier(GenDisMixClassifierParameterSet params, LogPrior prior, double[] beta, DifferentiableStatisticalModel... score) throws CloneNotSupportedException
params
- the common parametersprior
- the prior for the parameters of the classifierbeta
- the weights for log likelihood, log conditional likelihood and log priorscore
- the functions for the classes
CloneNotSupportedException
- if an instance could not be clonepublic GenDisMixClassifier(GenDisMixClassifierParameterSet params, LogPrior prior, double genBeta, double disBeta, double priorBeta, DifferentiableStatisticalModel... score) throws CloneNotSupportedException
genBeta, disBeta,
and priorBeta
into an array and calls the main constructor.
params
- the common parametersprior
- the prior for the parameters of the classifiergenBeta
- the weight for the log likelihooddisBeta
- the weight for the log conditional likelihoodpriorBeta
- the weight for the log priorscore
- the functions for the classes
CloneNotSupportedException
- if an instance could not be clonepublic GenDisMixClassifier(GenDisMixClassifierParameterSet params, LogPrior prior, LearningPrinciple key, DifferentiableStatisticalModel... score) throws CloneNotSupportedException
params
- the common parametersprior
- the prior for the parameters of the classifierkey
- the key for an elementary LearningPrinciple
score
- the functions for the classes
CloneNotSupportedException
- if an instance could not be cloneLearningPrinciple.getBeta(LearningPrinciple)
public GenDisMixClassifier(StringBuffer xml) throws NonParsableException
Storable
.
xml
- the xml representation
NonParsableException
- if the representation could not be parsed.Method Detail |
---|
public GenDisMixClassifier clone() throws CloneNotSupportedException
clone
in class ScoreClassifier
CloneNotSupportedException
protected LogGenDisMixFunction getFunction(DataSet[] data, double[][] weights) throws Exception
ScoreClassifier
getFunction
in class ScoreClassifier
data
- the samplesweights
- the weights of the sequences of the samples
Exception
- if something went wrongpublic void setPrior(LogPrior prior)
isTrained
will return false
after invoking this method.
prior
- the new priorpublic void setWeights(double... beta) throws IllegalArgumentException
isTrained
will return false
after invoking this method.
beta
- the weights
IllegalArgumentException
- if the weights array is not correctLearningPrinciple.getBeta(LearningPrinciple)
protected String getXMLTag()
AbstractClassifier
String
that is used as tag for the XML representation
of the classifier. This method is used by the methods
AbstractClassifier.fromXML(StringBuffer)
and AbstractClassifier.toXML()
.
getXMLTag
in class ScoreClassifier
String
that is used as tag for the XML representation
of the classifierprotected StringBuffer getFurtherClassifierInfos()
AbstractClassifier
StringBuffer
. This method is used by the method AbstractClassifier.toXML()
and should not be made public.
getFurtherClassifierInfos
in class ScoreClassifier
StringBuffer
AbstractClassifier.toXML()
protected void extractFurtherClassifierInfosFromXML(StringBuffer xml) throws NonParsableException
AbstractClassifier
AbstractClassifier.fromXML(StringBuffer)
and
should not be made public.
extractFurtherClassifierInfosFromXML
in class ScoreClassifier
xml
- the XML representation as StringBuffer
NonParsableException
- if the information could not be parsed out of the XML
representation (the StringBuffer
could not be parsed)AbstractClassifier.fromXML(StringBuffer)
public static GenDisMixClassifier[] create(GenDisMixClassifierParameterSet params, LogPrior prior, double[] weights, DifferentiableStatisticalModel[]... functions) throws CloneNotSupportedException
DifferentiableStatisticalModel
s.
params
- the parameters that will be used in all classifiersprior
- the prior that will be used in all classifiersweights
- the weights that will be used in all classifiersfunctions
- the DifferentiableStatisticalModel
s
DifferentiableStatisticalModel
s that can be used for class i
CloneNotSupportedException
- if the some item could not be clonedGenDisMixClassifier(GenDisMixClassifierParameterSet, LogPrior, double[],
DifferentiableStatisticalModel[])
public String getInstanceName()
AbstractClassifier
getInstanceName
in class ScoreClassifier
public int getNumberOfThreads()
public String toString()
toString
in class Object
public void setNumberOfThreads(int threads) throws SimpleParameter.IllegalValueException
threads
- the number of threads
SimpleParameter.IllegalValueException
- if the number of threads is not possible
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |