org.apache.mahout.clustering.dirichlet.models
Class AsymmetricSampledNormalModel

java.lang.Object
  extended by org.apache.mahout.clustering.dirichlet.models.AsymmetricSampledNormalModel
All Implemented Interfaces:
org.apache.hadoop.io.Writable, Cluster, Model<VectorWritable>

public class AsymmetricSampledNormalModel
extends java.lang.Object
implements Cluster


Field Summary
 
Fields inherited from interface org.apache.mahout.clustering.Cluster
CLUSTERED_POINTS_DIR, CLUSTERS_DIR, INITIAL_CLUSTERS_DIR
 
Constructor Summary
AsymmetricSampledNormalModel()
           
AsymmetricSampledNormalModel(int id, Vector mean, Vector stdDev)
           
 
Method Summary
 java.lang.String asFormatString(java.lang.String[] bindings)
          Produce a custom, human-friendly, printable representation of the Cluster.
 java.lang.String asJsonString()
          Produce a textual representation of the Cluster using Json format.
 void computeParameters()
          Compute a new set of posterior parameters based upon the Observations that have been observed since my creation
 int count()
          Return the number of observations that have been observed by this model
 Vector getCenter()
          Get the "center" of the Cluster as a Vector
 int getId()
          Get the id of the Cluster
 Vector getMean()
           
 int getNumPoints()
          Get an integer denoting the number of points observed by this cluster
 Vector getRadius()
          Get the "radius" of the Cluster as a Vector.
 Vector getStdDev()
           
 void observe(VectorWritable v)
          Observe the given observation, retaining information about it
 double pdf(VectorWritable v)
          Return the probability that the observation is described by this model
 void readFields(java.io.DataInput in)
           
 AsymmetricSampledNormalModel sampleFromPosterior()
          Return an instance with the same parameters
 java.lang.String toString()
           
 void write(java.io.DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AsymmetricSampledNormalModel

public AsymmetricSampledNormalModel()

AsymmetricSampledNormalModel

public AsymmetricSampledNormalModel(int id,
                                    Vector mean,
                                    Vector stdDev)
Method Detail

getMean

public Vector getMean()

getStdDev

public Vector getStdDev()

sampleFromPosterior

public AsymmetricSampledNormalModel sampleFromPosterior()
Return an instance with the same parameters

Specified by:
sampleFromPosterior in interface Model<VectorWritable>
Returns:
an AsymmetricSampledNormalModel

observe

public void observe(VectorWritable v)
Description copied from interface: Model
Observe the given observation, retaining information about it

Specified by:
observe in interface Model<VectorWritable>
Parameters:
v - an Observation from the posterior

computeParameters

public void computeParameters()
Description copied from interface: Model
Compute a new set of posterior parameters based upon the Observations that have been observed since my creation

Specified by:
computeParameters in interface Model<VectorWritable>

pdf

public double pdf(VectorWritable v)
Description copied from interface: Model
Return the probability that the observation is described by this model

Specified by:
pdf in interface Model<VectorWritable>
Parameters:
v - an Observation from the posterior
Returns:
the probability that x is in the receiver

count

public int count()
Description copied from interface: Model
Return the number of observations that have been observed by this model

Specified by:
count in interface Model<VectorWritable>
Returns:
an int

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

asFormatString

public java.lang.String asFormatString(java.lang.String[] bindings)
Description copied from interface: Cluster
Produce a custom, human-friendly, printable representation of the Cluster.

Specified by:
asFormatString in interface Cluster
Parameters:
bindings - an optional String[] containing labels used to format the primary Vector/s of this implementation.
Returns:
a String

readFields

public void readFields(java.io.DataInput in)
                throws java.io.IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
java.io.IOException

write

public void write(java.io.DataOutput out)
           throws java.io.IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
java.io.IOException

asJsonString

public java.lang.String asJsonString()
Description copied from interface: Cluster
Produce a textual representation of the Cluster using Json format. (Label bindings are transient and not part of the Json representation)

Specified by:
asJsonString in interface Cluster
Returns:
a Json String

getCenter

public Vector getCenter()
Description copied from interface: Cluster
Get the "center" of the Cluster as a Vector

Specified by:
getCenter in interface Cluster
Returns:
a Vector

getId

public int getId()
Description copied from interface: Cluster
Get the id of the Cluster

Specified by:
getId in interface Cluster
Returns:
a unique integer

getNumPoints

public int getNumPoints()
Description copied from interface: Cluster
Get an integer denoting the number of points observed by this cluster

Specified by:
getNumPoints in interface Cluster
Returns:
an integer

getRadius

public Vector getRadius()
Description copied from interface: Cluster
Get the "radius" of the Cluster as a Vector. Usually the radius is the standard deviation expressed as a Vector of size equal to the center. Some clusters may return zero values if not appropriate.

Specified by:
getRadius in interface Cluster
Returns:
aVector


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.