marf.Storage
Class TrainingSample

java.lang.Object
  extended bymarf.Storage.TrainingSample
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
Cluster

public class TrainingSample
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

TrainingSample contains one item in the training set. Each training sample consists of the feature vector plus information describing that feature vector. Has been extracted from TrainingSet in 0.3.0. TODO: fix CSV dumps

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

Since:
0.0.1
Version:
$Revision: 1.10 $
Author:
Stephen Sinclair, Serguei Mokhov
See Also:
Serialized Form

Field Summary
protected  double[] adDataVector
          Array represinting either a feature or mean vector describing the cluster.
protected  int iSubjectID
          Which subject this feature vector is associated with.
protected  java.util.Vector oFilenames
          A list of filenames that were used in training for this cluster.
 
Constructor Summary
TrainingSample()
          Default training sample constructor.
TrainingSample(TrainingSample poTrainingSample)
          Copy-constructor.
 
Method Summary
 java.lang.Object clone()
          Implements Cloneable interface for the TrainingSample object.
 void dumpCSV(java.io.BufferedWriter poBufferedWriter)
          Writes one training sample to a CSV file.
 double[] getDataVector()
          Retrieves the data vector.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 int getSubjectID()
          Retrieves Subject ID of a particular training sample.
 void restoreCSV(java.io.BufferedReader poBufferedReader)
          Retrieve one training sample from a CSV file.
 void setDataVector(double[] padDataVector)
          Sets new mean vector.
 void setFilename(java.lang.String pstrFilename)
          Sets a filename of the training sample.
 void setSubjectID(int piSubjectID)
          Sets new Subject ID.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iSubjectID

protected int iSubjectID
Which subject this feature vector is associated with.


adDataVector

protected double[] adDataVector
Array represinting either a feature or mean vector describing the cluster.


oFilenames

protected java.util.Vector oFilenames
A list of filenames that were used in training for this cluster. Used to avoid duplicate training on the same filename.

Constructor Detail

TrainingSample

public TrainingSample()
Default training sample constructor. Explicitly appeared in 0.3.0.5.

Since:
0.3.0.5

TrainingSample

public TrainingSample(TrainingSample poTrainingSample)
Copy-constructor.

Parameters:
poTrainingSample - TrainingSample object to copy
Since:
0.3.0.5
Method Detail

setFilename

public final void setFilename(java.lang.String pstrFilename)
Sets a filename of the training sample. Allways set the first element of the list of filenames.

Parameters:
pstrFilename - filename to set

getSubjectID

public final int getSubjectID()
Retrieves Subject ID of a particular training sample.

Returns:
int ID

getDataVector

public final double[] getDataVector()
Retrieves the data vector.

Returns:
array of doubles representing the data for this subject

setSubjectID

public final void setSubjectID(int piSubjectID)
Sets new Subject ID.

Parameters:
piSubjectID - integer ID

setDataVector

public final void setDataVector(double[] padDataVector)
Sets new mean vector.

Parameters:
padDataVector - double array representing the mean vector

dumpCSV

public void dumpCSV(java.io.BufferedWriter poBufferedWriter)
             throws StorageException
Writes one training sample to a CSV file.

Parameters:
poBufferedWriter - BufferedWriter
Throws:
StorageException - in case of I/O or otherwise error

restoreCSV

public void restoreCSV(java.io.BufferedReader poBufferedReader)
                throws StorageException
Retrieve one training sample from a CSV file. TODO: FIX, for it's BROKEN.

Parameters:
poBufferedReader - BufferedReader
Throws:
StorageException - in case of I/O or otherwise error

clone

public java.lang.Object clone()
Implements Cloneable interface for the TrainingSample object.

Since:
0.3.0.5
See Also:
Object.clone()

getMARFSourceCodeRevision

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

Returns:
revision string
Since:
0.3.0.2


SourceForge Logo