|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.classify.TrainableClassifier
de.fu_berlin.ties.classify.ExternalClassifier
A proxy that provides a trainable classifier by communicating with an external (non-Java) program. Program name and command line options of the external classifier can be configured.
Instances of this class are thread-safe if and only if several instances of the external classifier can reliably run in parallel.
Field Summary | |
static String |
CONFIG_DIR
Configuration key: the directory to run the classifier in (optional, defaults to current working directory). |
Fields inherited from interface de.fu_berlin.ties.classify.Classifier |
CONFIG_CLASSIFIER |
Constructor Summary | |
ExternalClassifier(Set allValidClasses)
Creates a new instance based on the standard TIES configuration. |
|
ExternalClassifier(Set allValidClasses,
FeatureTransformer trans,
File runDirectory,
TiesConfiguration config)
Creates a new instance based on the provided arguments. |
|
ExternalClassifier(Set allValidClasses,
TiesConfiguration config)
Creates a new instance based on the provided configuration. |
Method Summary | |
protected PredictionDistribution |
doClassify(FeatureVector features,
Set candidateClasses)
Classifies an item that is represented by a feature vector by choosing the most probable class among a set of candidate classes. |
protected void |
doTrain(FeatureVector features,
String targetClass)
Incorporates an item that is represented by a feature vector into the classification model. |
void |
init(String cls)
Initializes a class. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class de.fu_berlin.ties.classify.TrainableClassifier |
classify, createClassifier, createClassifier, createClassifier, getAllClasses, train, trainOnError, trainOnErrorHook |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String CONFIG_DIR
Constructor Detail |
public ExternalClassifier(Set allValidClasses) throws ProcessingException
allValidClasses
- the set of all valid classes
ProcessingException
- if an I/O error occurs during initializationpublic ExternalClassifier(Set allValidClasses, TiesConfiguration config) throws ProcessingException
allValidClasses
- the set of all valid classesconfig
- contains configuration properties
ProcessingException
- if an I/O error occurs during initializationpublic ExternalClassifier(Set allValidClasses, FeatureTransformer trans, File runDirectory, TiesConfiguration config) throws ProcessingException
allValidClasses
- the set of all valid classestrans
- the last transformer in the transformer chain to use, or
null
if no feature transformers should be usedrunDirectory
- the directory to run the classifier in; used instead
of the configured directory if not
null
config
- contains configuration properties
ProcessingException
- if an I/O error occurs during initializationMethod Detail |
protected PredictionDistribution doClassify(FeatureVector features, Set candidateClasses) throws ProcessingException
doClassify
in class TrainableClassifier
features
- the feature vector to considercandidateClasses
- an array of the classes that are allowed for
this item
PredictionDistribution.best()
to get the most probably class;
this classifier returns only the best prediction, so
PredictionDistribution.size()
will be 1
ProcessingException
- if an I/O error occurs during communication
with the external programprotected void doTrain(FeatureVector features, String targetClass) throws ProcessingException
doTrain
in class TrainableClassifier
features
- the feature vector to considertargetClass
- the class of this feature vector
ProcessingException
- if an I/O error occurs during communication
with the external programpublic void init(String cls) throws ProcessingException
cls
- the class to initialize
ProcessingException
- if an I/O error occurs during initializationpublic String toString()
toString
in class TrainableClassifier
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |