|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.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 copyMethod 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 ITrainingSample
ITrainingSample.setFeatureVector(double[], String, int)
public void setFilename(java.lang.String pstrFilename)
ITrainingSample
setFilename
in interface ITrainingSample
pstrFilename
- 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 ITrainingSample
pstrFilename
- filename to add
false
if the filename is already there; true
otherwiseexistsFilename(String)
public boolean existsFilename(java.lang.String pstrFilename)
ITrainingSample
existsFilename
in interface ITrainingSample
pstrFilename
- filename to check
true
if the filename is there; false
if notpublic final int getSubjectID()
ITrainingSample
getSubjectID
in interface ITrainingSample
public final double[] getDataVector()
ITrainingSample
getDataVector
in interface ITrainingSample
public void setSubjectID(int piSubjectID)
ITrainingSample
setSubjectID
in interface ITrainingSample
piSubjectID
- integer IDpublic void setDataVector(double[] padDataVector)
ITrainingSample
setDataVector
in interface ITrainingSample
padDataVector
- double array representing the mean vectorpublic void dumpCSV(java.io.BufferedWriter poBufferedWriter) throws StorageException
poBufferedWriter
- BufferedWriter
StorageException
- in case of I/O or otherwise errorpublic 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 ITrainingSample
ITrainingSample.getMeanCount()
public double[] getMeanVector()
getDataVector()
.
getMeanVector
in interface ITrainingSample
getDataVector()
public double[] getMedianVector()
getDataVector()
.
getMedianVector
in interface ITrainingSample
getDataVector()
public int size()
size
in interface ITrainingSample
ITrainingSample.size()
public java.lang.Object clone()
clone
in class java.lang.Object
Object.clone()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |