|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarf.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 | |
|---|---|
private StatisticalObject[] |
aoSortedStatRefs
Sorted references to stats. |
private boolean |
bDumpLogariphm
Indicates whether to dump in log-log scale format or not. |
static int |
DEFAULT_OUTPUT_PAGE_SIZE
Default number of entries display/output per page. |
private int |
iMaxWordLength
The length of a longest word found in characters. |
private int |
iMinWordLength
The length of a smallest word found in characters. |
private int |
iOutputPageSize
When the results are dumped in the text mode, tell how many records to show per page. |
private java.util.Hashtable |
oStats
Local collection of word stats. |
private static long |
serialVersionUID
For serialization versioning. |
| 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. |
private void |
rankAll()
Ranks results. |
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. |
private void |
sort()
Sorts results. |
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
private java.util.Hashtable oStats
private StatisticalObject[] aoSortedStatRefs
private boolean bDumpLogariphm
private int iMaxWordLength
private int iMinWordLength
private int iOutputPageSize
private static final long serialVersionUID
serialver tool that comes with JDK.
| Constructor Detail |
|---|
public ZipfLaw(java.lang.String pstrStatsFilename)
pstrStatsFilename - the desired file to processpublic ZipfLaw(IFeatureExtraction poFeatureExtraction)
poFeatureExtraction - preprocessing module to get the data from| Method Detail |
|---|
public boolean classify(double[] padFeatureVector)
throws ClassificationException
Stochastic
classify in interface IClassificationclassify in class StochasticpadFeatureVector - 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 IClassificationtrain in class StochasticpadFeatureVector - feature vector to train on
ClassificationException - never thrownIClassification.train(double[])public Result getResult()
Stochastic
getResult in interface IClassificationgetResult in class StochasticIClassification.getResult()
public final void collectStatistics(double[] padFeatures)
throws ClassificationException
padFeatures - desired stream tokenizer
ClassificationException - in case of inner exceptions
public final void collectStatistics(java.io.StreamTokenizer poStreamTokenizer)
throws ClassificationException
poStreamTokenizer - desired stream tokenizer
ClassificationException - in case of inner exceptionsprivate void sort()
private final void rankAll()
public final void dumpAll()
public final void dumpGraphValues()
throws java.io.IOException
java.io.IOExceptionpublic void backSynchronizeObject()
StorageManagerrestore(). By default
this method is unimplemented.
backSynchronizeObject in class StorageManagerrestore(),
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 IStorageManagerdump in class ClassificationStorageException - 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 IStorageManagerrestore in class ClassificationStorageException - 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 IStorageManagerdumpCSV in class StorageManagerStorageException - 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 StorageManagerObject.toString()public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||