|
||||||||||
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.ZipfLaw
public class ZipfLaw
Module exercising Zipf's Law.
$Id: ZipfLaw.java,v 1.32 2007/12/31 00:17:05 mokhov Exp $
Field Summary | |
---|---|
static int |
DEFAULT_OUTPUT_PAGE_SIZE
Default number of entries display/output per page. |
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 | |
---|---|
ZipfLaw(IFeatureExtraction poFeatureExtraction)
Classification API. |
|
ZipfLaw(java.lang.String pstrStatsFilename)
Takes a filename argument. |
Method Summary | |
---|---|
void |
backSynchronizeObject()
Must to be overridden by the modules that use object serialization with the generic implementation of restore() . |
boolean |
classify(double[] padFeatureVector)
Not Implemented. |
void |
collectStatistics(double[] padFeatures)
Collects result statistics. |
void |
collectStatistics(java.io.StreamTokenizer poStreamTokenizer)
Collects result statistics. |
void |
dump()
An object must know how dump itself or its data structures to a file. |
void |
dumpAll()
Dumps results to STDOUT. |
void |
dumpCSV()
Implements CSV dump through the dumpGraphValues()
method. |
void |
dumpGraphValues()
Dumps CVS values of the rank and frequency into a file. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
int |
getMaxWordLength()
Allows getting the length of the longest word found (in characters). |
int |
getMinWordLength()
Allows getting the length of the smallest word found (in characters). |
Result |
getResult()
Retrieves the maximum-probability classification result. |
StatisticalObject[] |
getSortedStatRefs()
Allows getting an array of sorted references to WordStats objects. |
java.util.Hashtable |
getStats()
Allows getting raw Hashtable of the WordStats objects. |
WordStats |
getWordStats(java.lang.String pstrLexeme)
Allows getting a particular WordStats object by its lexeme. |
boolean |
isDumpLogariphmOn()
Allows examining the value of the log-log flag. |
void |
restore()
An object must know how restore itself or its data structures from a file. |
void |
setDumpLogariphm(boolean pbDumpLogariphm)
Allows setting the dump log-log flag to indicate the module to dump graphs in the log-log scale. |
java.lang.String |
toString()
Reports minimum and maximum word lengths and the dictionary itself in a form of a String. |
boolean |
train(double[] padFeatureVector)
Not Implemented. |
Methods inherited from class marf.Classification.Classification |
---|
classify, clone, getFeatureExtraction, getResultSet, getTrainingSetFilename, loadTrainingSet, setFeatureExtraction, train |
Methods inherited from class marf.Storage.StorageManager |
---|
dumpBinary, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, equals, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, getObjectToSerialize, hashCode, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_OUTPUT_PAGE_SIZE
Constructor Detail |
---|
public ZipfLaw(java.lang.String pstrStatsFilename)
pstrStatsFilename
- the desired file to processpublic ZipfLaw(IFeatureExtraction poFeatureExtraction)
poFeatureExtraction
- preprocessing module to get the data fromMethod Detail |
---|
public boolean classify(double[] padFeatureVector) throws ClassificationException
Stochastic
classify
in interface IClassification
classify
in class Stochastic
padFeatureVector
- vector of features to compare with the stored ones
ClassificationException
- never thrownIClassification.classify(double[])
public boolean train(double[] padFeatureVector) throws ClassificationException
Stochastic
train
in interface IClassification
train
in class Stochastic
padFeatureVector
- feature vector to train on
ClassificationException
- never thrownIClassification.train(double[])
public Result getResult()
Stochastic
getResult
in interface IClassification
getResult
in class Stochastic
IClassification.getResult()
public final void collectStatistics(double[] padFeatures) throws ClassificationException
padFeatures
- desired stream tokenizer
ClassificationException
- in case of inner exceptionspublic final void collectStatistics(java.io.StreamTokenizer poStreamTokenizer) throws ClassificationException
poStreamTokenizer
- desired stream tokenizer
ClassificationException
- in case of inner exceptionspublic final void dumpAll()
public final void dumpGraphValues() throws java.io.IOException
java.io.IOException
public void backSynchronizeObject()
StorageManager
restore()
. By default
this method is unimplemented.
backSynchronizeObject
in class StorageManager
restore()
,
StorageManager.backSynchronizeObject()
public void dump() throws StorageException
dump*()
methods based on the current dump mode.
This derivative uses only DUMP_GZIP_BINARY
, DUMP_BINARY
and DUMP_CSV_TEXT
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()
,
dumpCSV()
,
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
,
IStorageManager.DUMP_CSV_TEXT
,
StorageManager.dumpGzipBinary()
,
StorageManager.dumpBinary()
,
dumpCSV()
,
backSynchronizeObject()
,
StorageManager.iCurrentDumpMode
public void dumpCSV() throws StorageException
dumpGraphValues()
method.
dumpCSV
in interface IStorageManager
dumpCSV
in class StorageManager
StorageException
- in case of any I/O errordumpGraphValues()
public boolean isDumpLogariphmOn()
setDumpLogariphm(boolean)
public void setDumpLogariphm(boolean pbDumpLogariphm)
pbDumpLogariphm
- new value of the log-log flagpublic final StatisticalObject[] getSortedStatRefs()
public final java.util.Hashtable getStats()
public final WordStats getWordStats(java.lang.String pstrLexeme)
pstrLexeme
- lexeme to look up the WordStats entry
null
if not foundpublic final int getMaxWordLength()
public final int getMinWordLength()
public java.lang.String toString()
toString
in class StorageManager
Object.toString()
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |