marf.Classification
Class Classification

java.lang.Object
  extended bymarf.Storage.StorageManager
      extended bymarf.Classification.Classification
All Implemented Interfaces:
java.lang.Cloneable, IClassification, IStorageManager, java.io.Serializable
Direct Known Subclasses:
Distance, NeuralNetwork, RandomClassification, Stochastic

public abstract class Classification
extends StorageManager
implements IClassification

Abstract Classification Module. A generic implementation of the IClassification interface. The derivatives must inherit from this module, and if they cannot, they should implement IClassification themselves.

$Id: Classification.java,v 1.41 2006/01/02 22:24:00 mokhov Exp $

Since:
0.0.1
Version:
$Revision: 1.41 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Field Summary
protected  IFeatureExtraction oFeatureExtraction
          Reference to the enclosed FeatureExtraction object.
protected  ResultSet oResultSet
          Classification result set.
protected  TrainingSet oTrainingSet
          TrainingSet Container.
 
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
protected Classification(IFeatureExtraction poFeatureExtraction)
          Generic Classification Constructor.
 
Method Summary
 java.lang.Object clone()
          Implementes Cloneable interface for the Classification object.
 void dump()
          Generic implementation of dump() to dump the TrainingSet.
 IFeatureExtraction getFeatureExtraction()
          Retrieves the features source.
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
 ResultSet getResultSet()
          Retrieves the enclosed result set.
protected  java.lang.String getTrainingSetFilename()
          Constructs a global cluster file name for the TrainingSet.
 void restore()
          Generic implementation of restore() for TrainingSet.
 void setFeatureExtraction(IFeatureExtraction poFeatureExtraction)
          Allows setting the features surce.
 boolean train()
          Generic training routine for building/updating mean vectors in the training set.
 
Methods inherited from class marf.Storage.StorageManager
backSynchronizeObject, dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, equals, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, hashCode, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface marf.Classification.IClassification
classify, getResult
 

Field Detail

oFeatureExtraction

protected IFeatureExtraction oFeatureExtraction
Reference to the enclosed FeatureExtraction object.


oTrainingSet

protected TrainingSet oTrainingSet
TrainingSet Container.


oResultSet

protected ResultSet oResultSet
Classification result set. May contain one or more results (in case of similarity).

Since:
0.3.0.2
Constructor Detail

Classification

protected Classification(IFeatureExtraction poFeatureExtraction)
Generic Classification Constructor.

Parameters:
poFeatureExtraction - FeatureExtraction module reference
Method Detail

train

public boolean train()
              throws ClassificationException
Generic training routine for building/updating mean vectors in the training set. Can be overridden, and if the overriding classifier is using TrainingSet, it should call super.train();

Specified by:
train in interface IClassification
Returns:
true if training was successful (i.e. mean vector was updated); false otherwise
Throws:
ClassificationException - if there was a problem while training
See Also:
TrainingSet

dump

public void dump()
          throws StorageException
Generic implementation of dump() to dump the TrainingSet.

Specified by:
dump in interface IStorageManager
Overrides:
dump in class StorageManager
Throws:
StorageException - if there's a problem saving training set to disk
Since:
0.2.0
See Also:
IStorageManager.DUMP_GZIP_BINARY, IStorageManager.DUMP_BINARY, StorageManager.dumpGzipBinary(), StorageManager.dumpCSV(), StorageManager.dumpBinary(), StorageManager.dumpXML(), StorageManager.dumpHTML(), StorageManager.dumpSQL(), StorageManager.backSynchronizeObject(), StorageManager.iCurrentDumpMode

restore

public void restore()
             throws StorageException
Generic implementation of restore() for TrainingSet.

Specified by:
restore in interface IStorageManager
Overrides:
restore in class StorageManager
Throws:
StorageException - if there is a problem loading the training set from disk
Since:
0.2.0
See Also:
IStorageManager.DUMP_GZIP_BINARY, IStorageManager.DUMP_BINARY, StorageManager.dumpGzipBinary(), StorageManager.dumpCSV(), StorageManager.dumpBinary(), StorageManager.dumpXML(), StorageManager.dumpHTML(), StorageManager.dumpSQL(), StorageManager.backSynchronizeObject(), StorageManager.iCurrentDumpMode

getResultSet

public ResultSet getResultSet()
Retrieves the enclosed result set.

Specified by:
getResultSet in interface IClassification
Returns:
the enclosed ResultSet object
Since:
0.3.0.2

getTrainingSetFilename

protected java.lang.String getTrainingSetFilename()
Constructs a global cluster file name for the TrainingSet.

Filename is constructed using fully-qualified class of either TrainingSet or a classifier name with global clustering info such as preprocessing and feature extraction methods, so that ony that cluster can be reloaded after.

May be overridden by the drivatives when necessary.

Returns:
String, filename
Since:
0.2.0

getFeatureExtraction

public IFeatureExtraction getFeatureExtraction()
Retrieves the features source.

Specified by:
getFeatureExtraction in interface IClassification
Returns:
returns the FeatureExtraction reference
Since:
0.3.0.4

setFeatureExtraction

public void setFeatureExtraction(IFeatureExtraction poFeatureExtraction)
Allows setting the features surce.

Specified by:
setFeatureExtraction in interface IClassification
Parameters:
poFeatureExtraction - the FeatureExtraction object to set
Since:
0.3.0.4

clone

public java.lang.Object clone()
Implementes Cloneable interface for the Classification object. The contained FeatureExtraction isn't cloned at this point, and is just assigned to the clone.

Overrides:
clone in class StorageManager
Since:
0.3.0.5
See Also:
Object.clone()

getMARFSourceCodeRevision

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

Returns:
revision string
Since:
0.3.0.2


SourceForge Logo