|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarf.Storage.TrainingSample
public class TrainingSample
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.15 2008/02/20 07:29:06 mokhov Exp $
| Field Summary | |
|---|---|
protected double[] |
adDataVector
Array representing either a feature vector, mean vector describing the cluster, or a median vector. |
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 sample. |
| Constructor Summary | |
|---|---|
TrainingSample()
Default training sample constructor. |
|
TrainingSample(TrainingSample poTrainingSample)
Copy-constructor. |
|
| Method Summary | |
|---|---|
boolean |
addFeatureVector(double[] padFeatureVector,
java.lang.String pstrFilename,
int piSubjectID)
Fully equivalent to setFeatureVector(). |
boolean |
addFilename(java.lang.String pstrFilename)
Adds a filename to the training sample. |
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. |
boolean |
existsFilename(java.lang.String pstrFilename)
Checks existence of the file in the training sample. |
double[] |
getDataVector()
Retrieves the data vector. |
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. |
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. |
boolean |
setFeatureVector(double[] padFeatureVector,
java.lang.String pstrFilename,
int piSubjectID)
|
void |
setFilename(java.lang.String pstrFilename)
Sets a filename of the training sample. |
void |
setSubjectID(int piSubjectID)
Sets new Subject ID. |
int |
size()
|
java.lang.String |
toString()
Provides string representation of the training sample data. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int iSubjectID
protected double[] adDataVector
protected java.util.Vector oFilenames
| Constructor Detail |
|---|
public TrainingSample()
public TrainingSample(TrainingSample poTrainingSample)
poTrainingSample - TrainingSample object to copy| Method Detail |
|---|
public boolean setFeatureVector(double[] padFeatureVector,
java.lang.String pstrFilename,
int piSubjectID)
setFeatureVector in interface ITrainingSample
public boolean addFeatureVector(double[] padFeatureVector,
java.lang.String pstrFilename,
int piSubjectID)
ITrainingSample
addFeatureVector in interface ITrainingSampleITrainingSample.setFeatureVector(double[], String, int)public void setFilename(java.lang.String pstrFilename)
ITrainingSample
setFilename in interface ITrainingSamplepstrFilename - filename to setpublic boolean addFilename(java.lang.String pstrFilename)
protected and can be made public
by the extending classes that allow more than one filename.
addFilename in interface ITrainingSamplepstrFilename - filename to add
false if the filename is already there; true otherwiseexistsFilename(String)public boolean existsFilename(java.lang.String pstrFilename)
ITrainingSample
existsFilename in interface ITrainingSamplepstrFilename - filename to check
true if the filename is there; false if notpublic final int getSubjectID()
ITrainingSample
getSubjectID in interface ITrainingSamplepublic final double[] getDataVector()
ITrainingSample
getDataVector in interface ITrainingSamplepublic void setSubjectID(int piSubjectID)
ITrainingSample
setSubjectID in interface ITrainingSamplepiSubjectID - integer IDpublic void setDataVector(double[] padDataVector)
ITrainingSample
setDataVector in interface ITrainingSamplepadDataVector - double array representing the mean vector
public void dumpCSV(java.io.BufferedWriter poBufferedWriter)
throws StorageException
poBufferedWriter - BufferedWriter
StorageException - in case of I/O or otherwise error
public void restoreCSV(java.io.BufferedReader poBufferedReader)
throws StorageException
poBufferedReader - BufferedReader
StorageException - in case of I/O or otherwise errorpublic int getMeanCount()
ITrainingSample
getMeanCount in interface ITrainingSampleITrainingSample.getMeanCount()public double[] getMeanVector()
getDataVector().
getMeanVector in interface ITrainingSamplegetDataVector()public double[] getMedianVector()
getDataVector().
getMedianVector in interface ITrainingSamplegetDataVector()public int size()
size in interface ITrainingSampleITrainingSample.size()public java.lang.Object clone()
clone in class java.lang.ObjectObject.clone()public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||