marf.Storage
Class FeatureSet

java.lang.Object
  extended by marf.Storage.TrainingSample
      extended by marf.Storage.Cluster
          extended by marf.Storage.FeatureSet
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ITrainingSample

public class FeatureSet
extends Cluster

FeatureSet -- Encapsulates subject's feature vectors. Additionally, can compute mean and median vectors off the present feature vectors.

$Id: FeatureSet.java,v 1.18 2008/02/17 02:26:53 mokhov Exp $

Since:
0.3.0.1
Version:
$Revision: 1.18 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Field Summary
private static int CACHED_VECTOR_TYPE_INVALID
          Cached vector's data is invalid (untrustworthy), i.e.
private static int CACHED_VECTOR_TYPE_MEAN
          The cached vector data represents a freshly computed mean vector.
private static int CACHED_VECTOR_TYPE_MEDIAN
          The cached vector data represents a freshly computed median vector.
private  int iLastTypeVectorComputed
          Type of the primary vector data member computed last.
private  int iMaxColumns
           
protected  java.util.Vector oFeatureVectors
          A Vector of TrainingSamples.
private static long serialVersionUID
          For serialization versioning.
 
Fields inherited from class marf.Storage.TrainingSample
adDataVector, iSubjectID, oFilenames
 
Constructor Summary
FeatureSet()
          Construct a training set object.
 
Method Summary
 boolean addFeatureVector(double[] padFeatureVector, java.lang.String pstrFilename, int piSubjectID)
          Adds new feature vector to the mean and recomputes the mean.
 java.lang.Object clone()
          Implements Cloneable interface for the FeatureSet object.
 void dumpCSV()
          Dump the current training set to disk.
 java.util.Vector getFeatureVectors()
          Retrieves training samples.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 int getMeanCount()
          Retrieves current mean count.
 double[] getMeanVector()
          Simply retrieves the data vector.
 double[] getMedianVector()
          Simply retrieves the data vector.
 void restoreCSV()
          Retrieve the current training set from disk.
 int size()
          Sizes of the feature vectors set.
 java.lang.String toString()
          Provides string representation of the training set data in addition to that of the parent Cluster.
 
Methods inherited from class marf.Storage.Cluster
addFilename, dumpCSV, existsFilename, restoreCSV, setMeanVector
 
Methods inherited from class marf.Storage.TrainingSample
getDataVector, getSubjectID, setDataVector, setFeatureVector, setFilename, setSubjectID
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

oFeatureVectors

protected java.util.Vector oFeatureVectors
A Vector of TrainingSamples.


CACHED_VECTOR_TYPE_INVALID

private static final int CACHED_VECTOR_TYPE_INVALID
Cached vector's data is invalid (untrustworthy), i.e. was either never computed yet or some other operation on the class invalidated it.

Since:
0.3.0.6
See Also:
Constant Field Values

CACHED_VECTOR_TYPE_MEAN

private static final int CACHED_VECTOR_TYPE_MEAN
The cached vector data represents a freshly computed mean vector.

Since:
0.3.0.6
See Also:
Constant Field Values

CACHED_VECTOR_TYPE_MEDIAN

private static final int CACHED_VECTOR_TYPE_MEDIAN
The cached vector data represents a freshly computed median vector.

Since:
0.3.0.6
See Also:
Constant Field Values

iLastTypeVectorComputed

private int iLastTypeVectorComputed
Type of the primary vector data member computed last.

See Also:
CACHED_VECTOR_TYPE_INVALID, CACHED_VECTOR_TYPE_MEAN, CACHED_VECTOR_TYPE_MEDIAN

iMaxColumns

private int iMaxColumns

serialVersionUID

private static final long serialVersionUID
For serialization versioning. When adding new members or make other structural changes regenerate this number with the serialver tool that comes with JDK.

Since:
0.3.0.4
See Also:
Constant Field Values
Constructor Detail

FeatureSet

public FeatureSet()
Construct a training set object.

Method Detail

getFeatureVectors

public java.util.Vector getFeatureVectors()
Retrieves training samples.

Returns:
vector of training samples.

size

public int size()
Sizes of the feature vectors set.

Specified by:
size in interface ITrainingSample
Overrides:
size in class TrainingSample
Returns:
number of training samples in the set
See Also:
ITrainingSample.size()

restoreCSV

public void restoreCSV()
                throws StorageException
Retrieve the current training set from disk. TODO: implement.

Throws:
StorageException
NotImplementedException
Since:
0.3.0.5

dumpCSV

public void dumpCSV()
             throws StorageException
Dump the current training set to disk. TODO: implement.

Throws:
StorageException
NotImplementedException
Since:
0.3.0.5

getMeanVector

public double[] getMeanVector()
Description copied from class: TrainingSample
Simply retrieves the data vector. Internally calls getDataVector().

Specified by:
getMeanVector in interface ITrainingSample
Overrides:
getMeanVector in class TrainingSample
Returns:
array of doubles representing the mean for that cluster
See Also:
TrainingSample.getDataVector()

getMedianVector

public double[] getMedianVector()
Description copied from class: TrainingSample
Simply retrieves the data vector. Internally calls getDataVector().

Specified by:
getMedianVector in interface ITrainingSample
Overrides:
getMedianVector in class TrainingSample
Returns:
array of doubles representing the mean for that cluster
See Also:
TrainingSample.getDataVector()

addFeatureVector

public boolean addFeatureVector(double[] padFeatureVector,
                                java.lang.String pstrFilename,
                                int piSubjectID)
Description copied from class: Cluster
Adds new feature vector to the mean and recomputes the mean.

Specified by:
addFeatureVector in interface ITrainingSample
Overrides:
addFeatureVector in class Cluster
Parameters:
padFeatureVector - vector to add
pstrFilename - filename to add
piSubjectID - for which subject that vector is
Returns:
true if the vector was added; false otherwise
See Also:
ITrainingSample.setFeatureVector(double[], String, int)

getMeanCount

public int getMeanCount()
Description copied from class: Cluster
Retrieves current mean count.

Specified by:
getMeanCount in interface ITrainingSample
Overrides:
getMeanCount in class Cluster
Returns:
mean count
See Also:
ITrainingSample.getMeanCount()

clone

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

Overrides:
clone in class Cluster
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 Cluster.

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

getMARFSourceCodeRevision

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

Returns:
revision string
Since:
0.3.0.2


SourceForge Logo