|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.Storage.StorageManager marf.Classification.Classification marf.Classification.Stochastic.Stochastic marf.Classification.Stochastic.MaxProbabilityClassifier
public class MaxProbabilityClassifier
Maximum Probability Classification Module.
Originally came with the LangIdentApp
NLP application
of Serguei Mokhov.
Field Summary | |
---|---|
protected java.util.Vector |
oAvailLanguages
A collection of available natural languages. |
protected StatisticalEstimator |
oStatisticalEstimator
Local reference to some instance of a statistical estimator for probability computation. |
Fields inherited from class marf.Classification.Classification |
---|
adFeatureVector, oFeatureExtraction, oResultSet, oTrainingSet |
Fields inherited from class marf.Storage.StorageManager |
---|
bDumpOnNotFound, iCurrentDumpMode, oObjectToSerialize, strFilename |
Fields inherited from interface marf.Classification.IClassification |
---|
MARF_INTERFACE_CODE_REVISION |
Fields inherited from interface marf.Storage.IStorageManager |
---|
DUMP_BINARY, DUMP_CSV_TEXT, DUMP_GZIP_BINARY, DUMP_HTML, DUMP_SQL, DUMP_XML, MARF_INTERFACE_CODE_REVISION, STORAGE_FILE_EXTENSIONS |
Constructor Summary | |
---|---|
MaxProbabilityClassifier(IFeatureExtraction poFeatureExtraction)
Implements Classification API. |
|
MaxProbabilityClassifier(StatisticalEstimator poStatisticalEstimator)
NLP constructor that takes directly a statistical estimator. |
Method Summary | |
---|---|
void |
backSynchronizeObject()
Add a piece of general StorageManager contract. |
boolean |
classify()
Performs language classification. |
void |
dump()
An object must know how dump itself or its data structures to a file. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
void |
init(StatisticalEstimator poStatisticalEstimator)
Initializes the classifier with all member variables. |
void |
restore()
An object must know how restore itself or its data structures from a file. |
boolean |
train()
Performs training of underlying statistical estimator and goes through restore/dump cycle to save the available languages. |
Methods inherited from class marf.Classification.Stochastic.Stochastic |
---|
classify, getResult, train |
Methods inherited from class marf.Classification.Classification |
---|
clone, getFeatureExtraction, getResultSet, getTrainingSetFilename, loadTrainingSet, setFeatureExtraction |
Methods inherited from class marf.Storage.StorageManager |
---|
dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, equals, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, getObjectToSerialize, hashCode, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected StatisticalEstimator oStatisticalEstimator
protected java.util.Vector oAvailLanguages
Constructor Detail |
---|
public MaxProbabilityClassifier(StatisticalEstimator poStatisticalEstimator)
poStatisticalEstimator
- statistical estimator to usepublic MaxProbabilityClassifier(IFeatureExtraction poFeatureExtraction)
poFeatureExtraction
- FeatureExtraction module referenceMethod Detail |
---|
public void init(StatisticalEstimator poStatisticalEstimator)
poStatisticalEstimator
- statistical estimator to use
java.lang.IllegalArgumentException
- if poStatisticalEstimator is nullpublic boolean train() throws ClassificationException
train
in interface IClassification
train
in class Classification
true
ClassificationException
- should there be a problem with dump/restoreTrainingSet
public boolean classify() throws ClassificationException
classify
in interface IClassification
classify
in class Classification
true
if classification was successful
ClassificationException
- if there was a problem with I/O
or if there are no available languagesIClassification.classify()
public void backSynchronizeObject()
backSynchronizeObject
in class StorageManager
StorageManager.restore()
public void dump() throws StorageException
DUMP_GZIP_BINARY
and DUMP_BINARY
modes.
dump
in interface IStorageManager
dump
in class Classification
StorageException
- if saving to a file for some reason fails or
the dump mode set to an unsupported valueStorageManager.dumpGzipBinary()
,
StorageManager.dumpBinary()
,
backSynchronizeObject()
public void restore() throws StorageException
restore*()
methods based on the current dump mode.
restore
in interface IStorageManager
restore
in class Classification
StorageException
- if loading from a file for some reason fails or
the dump mode set to an unsupported valueIStorageManager.DUMP_GZIP_BINARY
,
IStorageManager.DUMP_BINARY
,
StorageManager.dumpGzipBinary()
,
StorageManager.dumpBinary()
,
backSynchronizeObject()
,
StorageManager.iCurrentDumpMode
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |