marf.Classification.Stochastic
Class MaxProbabilityClassifier

java.lang.Object
  |
  +--marf.Storage.StorageManager
        |
        +--marf.Classification.Classification
              |
              +--marf.Classification.Stochastic.Stochastic
                    |
                    +--marf.Classification.Stochastic.MaxProbabilityClassifier
All Implemented Interfaces:
IStorageManager, java.io.Serializable

public class MaxProbabilityClassifier
extends Stochastic

Maximum Probability Classification Module.

Originally came with the LangIdentApp NLP application of Serguei Mokhov. $Id: MaxProbabilityClassifier.java,v 1.13 2005/05/09 16:38:12 mokhov Exp $

Since:
0.3.0
Version:
$Revision: 1.13 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Field Summary
protected  java.util.Vector oAvailLanguages
          A collection of available natural languages.
protected  marf.Stats.StatisticalEstimators.StatisticalEstimator oStatisticalEstimator
          Local reference to some instance of a statistical estimator for probability computation.
 
Fields inherited from class marf.Classification.Classification
oFeatureExtraction, oResultSet, oTrainingSet
 
Fields inherited from class marf.Storage.StorageManager
iCurrentDumpMode, oObjectToSerialize, strFilename
 
Fields inherited from interface marf.Storage.IStorageManager
DUMP_BINARY, DUMP_CSV_TEXT, DUMP_GZIP_BINARY, DUMP_HTML, DUMP_SQL, DUMP_XML, INTERFACE_CODE_REVISION, sastrExtensionsMap
 
Constructor Summary
MaxProbabilityClassifier(marf.FeatureExtraction.FeatureExtraction poFeatureExtraction)
          Implements Classification API.
MaxProbabilityClassifier(marf.Stats.StatisticalEstimators.StatisticalEstimator poStatisticalEstimator)
          NLP constructor that takes directly a statistical estimator.
 
Method Summary
 boolean classify()
          Performs language classification.
static java.lang.String getRevision()
          Retrieves class' revision.
 void init(marf.Stats.StatisticalEstimators.StatisticalEstimator poStatisticalEstimator)
          Initializes the classifier with all member variables.
 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
dump, getResult, restore
 
Methods inherited from class marf.Classification.Classification
getResultSet, getTrainingSetFilename
 
Methods inherited from class marf.Storage.StorageManager
backSynchronizeObject, dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oStatisticalEstimator

protected marf.Stats.StatisticalEstimators.StatisticalEstimator oStatisticalEstimator
Local reference to some instance of a statistical estimator for probability computation.


oAvailLanguages

protected java.util.Vector oAvailLanguages
A collection of available natural languages.

Constructor Detail

MaxProbabilityClassifier

public MaxProbabilityClassifier(marf.Stats.StatisticalEstimators.StatisticalEstimator poStatisticalEstimator)
NLP constructor that takes directly a statistical estimator.

Parameters:
poStatisticalEstimator - statistical estimator to use

MaxProbabilityClassifier

public MaxProbabilityClassifier(marf.FeatureExtraction.FeatureExtraction poFeatureExtraction)
Implements Classification API. TODO: fix setting of data memvers as in MaxProbabilityClassifier(StatisticalEstimator).

Parameters:
poFeatureExtraction - FeatureExtraction module reference
Method Detail

init

public void init(marf.Stats.StatisticalEstimators.StatisticalEstimator poStatisticalEstimator)
Initializes the classifier with all member variables.

Parameters:
poStatisticalEstimator - statistical estimator to use
Throws:
java.lang.IllegalArgumentException - if poStatisticalEstimator is null

train

public boolean train()
              throws ClassificationException
Performs training of underlying statistical estimator and goes through restore/dump cycle to save the available languages. Implements Classification API.

Overrides:
train in class Stochastic
Returns:
true
Throws:
ClassificationException - should there be a problem with dump/restore
See Also:
TrainingSet

classify

public boolean classify()
                 throws ClassificationException
Performs language classification. Implements Classification API.

Overrides:
classify in class Stochastic
Returns:
true if classification was successful; false otherwise
Throws:
ClassificationException - if there was a problem with I/O or if there are no available languages

getRevision

public static java.lang.String getRevision()
Retrieves class' revision.

Returns:
revision string