de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.shared
Class SharedStructureClassifier

java.lang.Object
  extended by de.jstacs.classifiers.AbstractClassifier
      extended by de.jstacs.classifiers.AbstractScoreBasedClassifier
          extended by de.jstacs.classifiers.trainSMBased.TrainSMBasedClassifier
              extended by de.jstacs.sequenceScores.statisticalModels.trainable.discrete.inhomogeneous.shared.SharedStructureClassifier
All Implemented Interfaces:
Storable, Cloneable

public class SharedStructureClassifier
extends TrainSMBasedClassifier

This class enables you to learn the structure on all classes of the classifier together. A special case is, for instance, a Tree Augmented Naive Bayes (TAN).

Author:
Jens Keilwagen

Nested Class Summary
 
Nested classes/interfaces inherited from class de.jstacs.classifiers.AbstractScoreBasedClassifier
AbstractScoreBasedClassifier.DoubleTableResult
 
Field Summary
 
Fields inherited from class de.jstacs.classifiers.trainSMBased.TrainSMBasedClassifier
models
 
Constructor Summary
SharedStructureClassifier(int length, StructureLearner.ModelType model, byte order, StructureLearner.LearningType method, FSDAGTrainSM... models)
          Creates a new SharedStructureClassifier from given FSDAGTrainSMs.
SharedStructureClassifier(StringBuffer xml)
          The standard constructor for the interface Storable.
 
Method Summary
 SharedStructureClassifier clone()
           
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() );
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" );
...
protected  StringBuffer getFurtherClassifierInfos()
          This method returns further information of a classifier as a StringBuffer.
 String getInstanceName()
          Returns a short description of the classifier.
 void train(DataSet[] data, double[][] weights)
          This method trains a classifier over an array of weighted DataSet s.
 
Methods inherited from class de.jstacs.classifiers.trainSMBased.TrainSMBasedClassifier
classify, getCharacteristics, getModel, getNumericalCharacteristics, getPossibleLength, getScore, getScores, getXMLTag, isInitialized
 
Methods inherited from class de.jstacs.classifiers.AbstractScoreBasedClassifier
check, check, classify, classify, createDefaultClassWeights, getClassWeight, getClassWeights, getMultiClassScores, getNumberOfClasses, getPValue, getPValue, getResults, getScore, setClassWeights, setClassWeights, setThresholdClassWeights
 
Methods inherited from class de.jstacs.classifiers.AbstractClassifier
evaluate, evaluate, getAlphabetContainer, getLength, toXML, train
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedStructureClassifier

public SharedStructureClassifier(int length,
                                 StructureLearner.ModelType model,
                                 byte order,
                                 StructureLearner.LearningType method,
                                 FSDAGTrainSM... models)
                          throws IllegalArgumentException,
                                 CloneNotSupportedException,
                                 ClassDimensionException
Creates a new SharedStructureClassifier from given FSDAGTrainSMs. This is the main constructor.

Parameters:
length - the sequence length
model - the type of the model
order - the order of the model
method - the learning method
models - the class models
Throws:
IllegalArgumentException - if order is below 0
CloneNotSupportedException - if at least one model could not be cloned
ClassDimensionException - if the class dimension is wrong (below 2)
See Also:
StructureLearner.ModelType, StructureLearner.LearningType, TrainSMBasedClassifier.TrainSMBasedClassifier(boolean, de.jstacs.sequenceScores.statisticalModels.trainable.TrainableStatisticalModel...)

SharedStructureClassifier

public SharedStructureClassifier(StringBuffer xml)
                          throws NonParsableException
The standard constructor for the interface Storable. Creates a new SharedStructureClassifier out of its XML representation.

Parameters:
xml - the XML representation as StringBuffer
Throws:
NonParsableException - if the SharedStructureClassifier could not be reconstructed out of the XML representation (the StringBuffer could not be parsed)
See Also:
Storable, TrainSMBasedClassifier.TrainSMBasedClassifier(StringBuffer)
Method Detail

clone

public SharedStructureClassifier clone()
                                throws CloneNotSupportedException
Overrides:
clone in class TrainSMBasedClassifier
Throws:
CloneNotSupportedException

train

public void train(DataSet[] data,
                  double[][] weights)
           throws IllegalArgumentException,
                  Exception
Description copied from class: AbstractClassifier
This method trains a classifier over an array of weighted DataSet s. That is why the following has to be fulfilled: This method should work non-incrementally as the method AbstractClassifier.train(DataSet...).

This method should check that the DataSets are defined over the underlying alphabet and length.

Overrides:
train in class TrainSMBasedClassifier
Parameters:
data - an array of DataSets
weights - the weights for the DataSets
Throws:
Exception - if the weights are incorrect or the training did not succeed
IllegalArgumentException
See Also:
AbstractClassifier.train(DataSet...)

getInstanceName

public String getInstanceName()
Description copied from class: AbstractClassifier
Returns a short description of the classifier.

Overrides:
getInstanceName in class TrainSMBasedClassifier
Returns:
a short description of the classifier

extractFurtherClassifierInfosFromXML

protected void extractFurtherClassifierInfosFromXML(StringBuffer xml)
                                             throws NonParsableException
Description copied from class: AbstractClassifier
Extracts further information of a classifier from an XML representation. This method is used by the method AbstractClassifier.fromXML(StringBuffer) and should not be made public.

Overrides:
extractFurtherClassifierInfosFromXML in class TrainSMBasedClassifier
Parameters:
xml - the XML representation as StringBuffer
Throws:
NonParsableException - if the information could not be parsed out of the XML representation (the StringBuffer could not be parsed)
See Also:
AbstractClassifier.fromXML(StringBuffer)

getFurtherClassifierInfos

protected StringBuffer getFurtherClassifierInfos()
Description copied from class: AbstractClassifier
This method returns further information of a classifier as a StringBuffer. This method is used by the method AbstractClassifier.toXML() and should not be made public.

Overrides:
getFurtherClassifierInfos in class TrainSMBasedClassifier
Returns:
further information of a classifier as a StringBuffer
See Also:
AbstractClassifier.toXML()

getClassifierAnnotation

public CategoricalResult[] getClassifierAnnotation()
Description copied from class: AbstractClassifier
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() );
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" );
...

Overrides:
getClassifierAnnotation in class TrainSMBasedClassifier
Returns:
an array of Results that contains information about the classifier