marf.Storage
Class Cluster

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

public class Cluster
extends TrainingSample

Cluster contains a cluster information per subject.

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

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

Field Summary
 
Fields inherited from class marf.Storage.TrainingSample
adDataVector, iSubjectID, oFilenames
 
Constructor Summary
Cluster()
          Default cluster constructor.
Cluster(Cluster poCluster)
          Copy-constructor.
 
Method Summary
 boolean addFeatureVector(double[] padFeatureVector, java.lang.String pstrFilename, int piSubjectID)
          Adds new feature vector to the mean and recomputes the mean.
 boolean addFilename(java.lang.String pstrFilename)
          Adds a filename to the training set.
 java.lang.Object clone()
          Implements Cloneable interface for the Cluster object.
 void dumpCSV(java.io.BufferedWriter poWriter)
          Write one training cluster as a CSV text.
 boolean existsFilename(java.lang.String pstrFilename)
          Checks existence of the file in the training set.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 int getMeanCount()
          Retrieves current mean count.
 void restoreCSV(java.io.BufferedReader poReader)
          Retrieve one training cluster from the specified reader as a CSV text.
 void setMeanVector(double[] padMeanVector)
          Sets new mean vector.
 java.lang.String toString()
          Provides string representation of the training set data in addition to that of the parent TrainingSample.
 
Methods inherited from class marf.Storage.TrainingSample
getDataVector, getMeanVector, getMedianVector, getSubjectID, setDataVector, setFeatureVector, setFilename, setSubjectID, size
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Cluster

public Cluster()
Default cluster constructor. Explicitly appeared in 0.3.0.5.

Since:
0.3.0.5

Cluster

public Cluster(Cluster poCluster)
Copy-constructor.

Parameters:
poCluster - the Cluster object to copy properties of
Since:
0.3.0.5
Method Detail

addFilename

public boolean addFilename(java.lang.String pstrFilename)
Adds a filename to the training set.

Specified by:
addFilename in interface ITrainingSample
Overrides:
addFilename in class TrainingSample
Parameters:
pstrFilename - filename to add
Returns:
false if the filename is already there; true otherwise
See Also:
existsFilename(String)

existsFilename

public boolean existsFilename(java.lang.String pstrFilename)
Checks existence of the file in the training set. Serves as an indication that we already trained on the given file.

Specified by:
existsFilename in interface ITrainingSample
Overrides:
existsFilename in class TrainingSample
Parameters:
pstrFilename - filename to check
Returns:
true if the filename is there; false if not

getMeanCount

public int getMeanCount()
Retrieves current mean count.

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

setMeanVector

public void setMeanVector(double[] padMeanVector)
Sets new mean vector.

Parameters:
padMeanVector - double array representing the mean vector

addFeatureVector

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

Specified by:
addFeatureVector in interface ITrainingSample
Overrides:
addFeatureVector in class TrainingSample
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)

dumpCSV

public void dumpCSV(java.io.BufferedWriter poWriter)
             throws StorageException
Write one training cluster as a CSV text.

Overrides:
dumpCSV in class TrainingSample
Parameters:
poWriter - BufferedWriter to write to
Throws:
StorageException - in case of any error while dumping
Since:
0.3.0.5

restoreCSV

public void restoreCSV(java.io.BufferedReader poReader)
                throws StorageException
Retrieve one training cluster from the specified reader as a CSV text. Not implemented.

Overrides:
restoreCSV in class TrainingSample
Parameters:
poReader - BufferedReader to read from
Throws:
StorageException - never thrown
NotImplementedException
Since:
0.3.0.5

clone

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

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

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

getMARFSourceCodeRevision

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

Returns:
revision string
Since:
0.3.0.2


SourceForge Logo