public class MappingClassifier extends AbstractScoreBasedClassifier
mapDataSet(DataSet[])) and invoke
AbstractClassifier.evaluate(AbstractPerformanceMeasureParameterSet, boolean, DataSet...)
with these mapped DataSet. Alternatively, the method
AbstractClassifier.evaluate(AbstractPerformanceMeasureParameterSet, boolean, DataSet...) can
be used directly and the DataSets will be mapped internally
(i.e. inside the evaluate method).AbstractScoreBasedClassifier.DoubleTableResult| Constructor and Description |
|---|
MappingClassifier(AbstractScoreBasedClassifier classifier,
int... mapping)
Creates a new
MappingClassifier from a given classifier and a
class mapping. |
MappingClassifier(StringBuffer representation)
The standard constructor for the interface
Storable. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
extractFurtherClassifierInfosFromXML(StringBuffer xml)
Extracts further information of a classifier from an XML representation.
|
CategoricalResult[] |
getClassifierAnnotation()
Returns an array of
Results of dimension
AbstractClassifier.getNumberOfClasses() that contains information about the
classifier and for each class.
res[0] = new CategoricalResult( "classifier", "the kind of classifier", getInstanceName() ); |
protected StringBuffer |
getFurtherClassifierInfos()
This method returns further information of a classifier as a
StringBuffer. |
String |
getInstanceName()
Returns a short description of the classifier.
|
NumericalResultSet |
getNumericalCharacteristics()
Returns the subset of numerical values that are also returned by
AbstractClassifier.getCharacteristics(). |
protected boolean |
getResults(LinkedList list,
DataSet[] s,
double[][] weights,
AbstractPerformanceMeasureParameterSet<? extends PerformanceMeasure> params,
boolean exceptionIfNotComputeable)
This method computes the results for any evaluation of the classifier.
|
protected double |
getScore(Sequence seq,
int i,
boolean check)
This method returns the score for a given
Sequence and a given
class. |
protected String |
getXMLTag()
Returns the
String that is used as tag for the XML representation
of the classifier. |
boolean |
isInitialized()
This method gives information about the state of the classifier.
|
DataSet[] |
mapDataSet(DataSet[] s)
This method maps the given
DataSets to the internal classes. |
double[][] |
mapWeights(double[][] w)
This method maps the given
Sequence weights to the internal classes. |
void |
train(DataSet[] s,
double[][] weights)
This method trains a classifier over an array of weighted
DataSet
s. |
check, check, classify, classify, clone, createDefaultClassWeights, getClassWeight, getClassWeights, getMultiClassScores, getNumberOfClasses, getPValue, getPValue, getScore, getScores, setClassWeights, setClassWeights, setThresholdClassWeightsclassify, evaluate, evaluate, getAlphabetContainer, getCharacteristics, getLength, toXML, trainpublic MappingClassifier(AbstractScoreBasedClassifier classifier, int... mapping) throws CloneNotSupportedException
MappingClassifier from a given classifier and a
class mapping.classifier - the internal used classifiermapping - the mapping from the classes of the internal classifier to the
classes of this classifierCloneNotSupportedException - if something went wrong while cloning the classifierpublic MappingClassifier(StringBuffer representation) throws NonParsableException
Storable.
Creates a new MappingClassifier out of its XML representation.representation - the XML representation as StringBufferNonParsableException - if the MappingClassifier could not be reconstructed
out of the XML representation (the StringBuffer
representation could not be parsed)AbstractScoreBasedClassifier.AbstractScoreBasedClassifier(StringBuffer),
Storableprotected void extractFurtherClassifierInfosFromXML(StringBuffer xml) throws NonParsableException
AbstractClassifierAbstractClassifier.fromXML(StringBuffer) and
should not be made public.extractFurtherClassifierInfosFromXML in class AbstractScoreBasedClassifierxml - the XML representation as StringBufferNonParsableException - if the information could not be parsed out of the XML
representation (the StringBuffer could not be parsed)AbstractClassifier.fromXML(StringBuffer)protected StringBuffer getFurtherClassifierInfos()
AbstractClassifierStringBuffer. This method is used by the method AbstractClassifier.toXML()
and should not be made public.getFurtherClassifierInfos in class AbstractScoreBasedClassifierStringBufferAbstractClassifier.toXML()protected double getScore(Sequence seq, int i, boolean check) throws IllegalArgumentException, NotTrainedException, Exception
AbstractScoreBasedClassifierSequence and a given
class.getScore in class AbstractScoreBasedClassifierseq - the Sequencei - the index of the classcheck - the switch to decide whether to check
AlphabetContainer and the length of the
Sequence or notSequence and a given classIllegalArgumentException - if something is wrong with the Sequence
seqNotTrainedException - if the classifier is not trainedException - if something went wrongpublic CategoricalResult[] getClassifierAnnotation()
AbstractClassifierResults of dimension
AbstractClassifier.getNumberOfClasses() that contains information about the
classifier and for each class.
res[0] = new CategoricalResult( "classifier", "the kind of classifier", getInstanceName() );
res[1] = new CategoricalResult( "class info 0", "some information about the class", "info0" );
res[2] = new CategoricalResult( "class info 1", "some information about the class", "info1" );
...
getClassifierAnnotation in class AbstractClassifierResults that contains information about the
classifierpublic String getInstanceName()
AbstractClassifiergetInstanceName in class AbstractClassifierpublic NumericalResultSet getNumericalCharacteristics() throws Exception
AbstractClassifierAbstractClassifier.getCharacteristics().getNumericalCharacteristics in class AbstractClassifierException - if some of the characteristics could not be definedprotected String getXMLTag()
AbstractClassifierString 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 AbstractClassifierString that is used as tag for the XML representation
of the classifierpublic boolean isInitialized()
AbstractClassifierisInitialized in class AbstractClassifiertrue if the classifier is initialized and therefore able
to classify sequences, otherwise falsepublic void train(DataSet[] s, double[][] weights) throws Exception
AbstractClassifierDataSet
s. That is why the following has to be fulfilled:
s.length == weights.length
weights[i] == null || s[i].getNumberOfElements() == weights[i].length.
AbstractClassifier.train(DataSet...).
DataSets are defined over the
underlying alphabet and length.train in class AbstractClassifiers - an array of DataSetsweights - the weights for the DataSetsException - if the weights are incorrect or the training did not succeedAbstractClassifier.train(DataSet...)protected boolean getResults(LinkedList list, DataSet[] s, double[][] weights, AbstractPerformanceMeasureParameterSet<? extends PerformanceMeasure> params, boolean exceptionIfNotComputeable) throws Exception
AbstractClassifiergetResults in class AbstractScoreBasedClassifierlist - a list adding the resultss - the array of DataSetsweights - the weights of the sequences for each data setparams - the current parametersexceptionIfNotComputeable - indicates the method throws an Exception if a measure
could not be computedException - if something went wrongAbstractClassifier.evaluate(AbstractPerformanceMeasureParameterSet, boolean, DataSet[], double[][]),
NumericalResult,
Resultpublic DataSet[] mapDataSet(DataSet[] s)
DataSets to the internal classes.s - the array of DataSetspublic double[][] mapWeights(double[][] w)
Sequence weights to the internal classes.w - the array of weights