marf.Storage
Class TrainingSet

java.lang.Object
  extended by marf.Storage.StorageManager
      extended by marf.Storage.TrainingSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, IStorageManager

public class TrainingSet
extends StorageManager

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

$Id: TrainingSet.java,v 1.49 2008/02/20 07:29:06 mokhov Exp $

Since:
0.0.1, December 5, 2002
Version:
$Revision: 1.49 $
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  int iTrainingSetFormat
           
protected  java.util.Vector oTrainingSamples
          A collection of Clusters.
static int TRAINING_SET_CLUSTERS
           
static int TRAINING_SET_FEATURE_SETS
           
static int TRAINING_SET_SAMPLES
           
 
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 backSynchronizeObject()
          Must to be overridden by the modules that use object serialization with the generic implementation of restore().
 java.lang.Object clone()
          Implements Cloneable interface for the TrainingSet object.
 void dumpCSV()
          If derivatives use the generic implementation of dump() with the CSV dump mode, they must override this method.
 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.
 int getTrainingSetFormat()
           
 void restore()
          Retrieves the current training set from disk.
 void restoreCSV()
          If derivatives use the generic implementation of restore() with the CSV dump mode, they must override this method.
 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.
 void setTrainingSetFormat(int piTrainingSetFormat)
           
 int size()
          Gets the size of the feature vectors set.
 java.lang.String toString()
          Provides string representation of the training set data in addition to that of the parent StorageManager.
 
Methods inherited from class marf.Storage.StorageManager
dump, dumpBinary, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, equals, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, getObjectToSerialize, hashCode, restoreBinary, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_TRAINING_SET_FILENAME

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

Since:
0.3.0.2
See Also:
Constant Field Values

TRAINING_SET_SAMPLES

public static final int TRAINING_SET_SAMPLES
See Also:
Constant Field Values

TRAINING_SET_CLUSTERS

public static final int TRAINING_SET_CLUSTERS
See Also:
Constant Field Values

TRAINING_SET_FEATURE_SETS

public static final int TRAINING_SET_FEATURE_SETS
See Also:
Constant Field Values

iTrainingSetFormat

protected int iTrainingSetFormat

oTrainingSamples

protected java.util.Vector oTrainingSamples
A collection of Clusters.


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

restoreCSV

public void restoreCSV()
                throws StorageException
Description copied from class: StorageManager
If derivatives use the generic implementation of restore() with the CSV dump mode, they must override this method.

Specified by:
restoreCSV in interface IStorageManager
Overrides:
restoreCSV in class StorageManager
Throws:
StorageException - in case of I/O or otherwise error
Since:
0.3.0.6
See Also:
IStorageManager.restoreCSV()

restore

public void restore()
             throws StorageException
Retrieves 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.restore()

dumpCSV

public void dumpCSV()
             throws StorageException
Description copied from class: StorageManager
If derivatives use the generic implementation of dump() with the CSV dump mode, they must override this method.

Specified by:
dumpCSV in interface IStorageManager
Overrides:
dumpCSV in class StorageManager
Throws:
StorageException - in case of I/O or otherwise error
Since:
0.3.0.6
See Also:
IStorageManager.dumpCSV()

getTrainingSetFormat

public int getTrainingSetFormat()
Returns:
Returns the iTrainingSetFormat.
Since:
0.3.0.6

setTrainingSetFormat

public void setTrainingSetFormat(int piTrainingSetFormat)
Parameters:
piTrainingSetFormat - The iTrainingSetFormat to set.
Since:
0.3.0.6

backSynchronizeObject

public void backSynchronizeObject()
Description copied from class: StorageManager
Must to be overridden by the modules that use object serialization with the generic implementation of restore(). By default this method is unimplemented.

Overrides:
backSynchronizeObject in class StorageManager
Since:
0.3.0.6
See Also:
StorageManager.backSynchronizeObject()

clone

public java.lang.Object clone()
Implements Cloneable interface for the TrainingSet object. Performs a "deep" copy of this object including all clusters and the feature set.

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

toString

public java.lang.String toString()
Provides string representation of the training set data in addition to that of the parent StorageManager.

Overrides:
toString in class StorageManager
Since:
0.3.0.6
See Also:
StorageManager.toString()

getMARFSourceCodeRevision

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

Returns:
revision string
Since:
0.3.0.2


SourceForge Logo