marf.Storage
Class TrainingSet

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

public class TrainingSet
extends StorageManager

TrainingSet -- Encapsulates Subject ID and subject's clusters or a feature set.

$Id: TrainingSet.java,v 1.43 2005/08/12 11:53:55 susan_fan Exp $

Since:
0.0.1, December 5, 2002
Version:
$Revision: 1.43 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_TRAINING_SET_FILENAME
          Default TrainingSet file name of marf.training.set.
protected  int iFeatureExtractionMethod
          Which feature extraction method was used to determine this feature vector.
protected  int iPreprocessingMethod
          Which preprocessing method was applied to the sample before this feature vector was extracted.
protected  java.util.Vector oClusters
          A Vector of Clusters.
protected  marf.Storage.FeatureSet oFeatureSet
          Feature Set as opposed to the cluster.
 
Fields inherited from class marf.Storage.StorageManager
bDumpOnNotFound, iCurrentDumpMode, oObjectToSerialize, strFilename
 
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
TrainingSet()
          Construct a training set object.
 
Method Summary
 boolean addFeatureVector(double[] padFeatureVector, java.lang.String pstrFilename, int piSubjectID, int piPreprocessingMethod, int piFeatureExtractionMethod)
          Adds new feature vector to the mean and recomputes the mean.
 void dump()
          Dump the current training set to disk.
 java.util.Vector getClusters()
          Retrieves clusters of training samples.
 int getFeatureExtractionMethod()
          Returns preprocessing method used on this training set.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 int getPreprocessingMethod()
          Returns preprocessing method used on this training set.
 void restore()
          Retrieve the current training set from disk.
 void setFeatureExtractionMethod(int piFeatureExtractionMethod)
          Sets feature extraction method used on this training set.
 void setPreprocessingMethod(int piPreprocessingMethod)
          Sets feature extraction method used on this training set.
 int size()
          Gets the size of the feature vectors set.
 
Methods inherited from class marf.Storage.StorageManager
backSynchronizeObject, dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, 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

DEFAULT_TRAINING_SET_FILENAME

public static final transient java.lang.String DEFAULT_TRAINING_SET_FILENAME
Default TrainingSet file name of marf.training.set.

Since:
0.3.0
See Also:
Constant Field Values

oClusters

protected java.util.Vector oClusters
A Vector of Clusters.


oFeatureSet

protected marf.Storage.FeatureSet oFeatureSet
Feature Set as opposed to the cluster.


iPreprocessingMethod

protected int iPreprocessingMethod
Which preprocessing method was applied to the sample before this feature vector was extracted.


iFeatureExtractionMethod

protected int iFeatureExtractionMethod
Which feature extraction method was used to determine this feature vector.

Constructor Detail

TrainingSet

public TrainingSet()
Construct a training set object.

Method Detail

getClusters

public final java.util.Vector getClusters()
Retrieves clusters of training samples.

Returns:
vector of training samples.

getPreprocessingMethod

public final int getPreprocessingMethod()
Returns preprocessing method used on this training set.

Returns:
the method

getFeatureExtractionMethod

public final int getFeatureExtractionMethod()
Returns preprocessing method used on this training set.

Returns:
piPreprocessingMethod the method

setPreprocessingMethod

public final void setPreprocessingMethod(int piPreprocessingMethod)
Sets feature extraction method used on this training set.

Parameters:
piPreprocessingMethod - the method

setFeatureExtractionMethod

public final void setFeatureExtractionMethod(int piFeatureExtractionMethod)
Sets feature extraction method used on this training set.

Parameters:
piFeatureExtractionMethod - the method

addFeatureVector

public final boolean addFeatureVector(double[] padFeatureVector,
                                      java.lang.String pstrFilename,
                                      int piSubjectID,
                                      int piPreprocessingMethod,
                                      int piFeatureExtractionMethod)
Adds new feature vector to the mean and recomputes the mean.

Parameters:
padFeatureVector - vector to add
pstrFilename - to check to avoid training on the same file
piSubjectID - for which subject that vector is
piPreprocessingMethod - preprocessing method used
piFeatureExtractionMethod - feature extraction method used
Returns:
true if the vector was added; false otherwise

size

public final int size()
Gets the size of the feature vectors set.

Returns:
number of training samples in the set

restore

public void restore()
             throws StorageException
Retrieve the current training set from disk.

Specified by:
restore in interface IStorageManager
Overrides:
restore in class StorageManager
Throws:
StorageException - in a case of I/O or otherwise error
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

dump

public void dump()
          throws StorageException
Dump the current training set to disk.

Specified by:
dump in interface IStorageManager
Overrides:
dump in class StorageManager
Throws:
StorageException - in a case of I/O or otherwise error
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

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Returns source code revision information.

Returns:
revision string
Since:
0.3.0.2