public abstract class AbstractCluster extends Object implements Cluster
Parametered.ParameteredGeneralizationsCLUSTERS_DIR, FINAL_ITERATION_SUFFIX, INITIAL_CLUSTERS_DIRlog| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCluster() |
protected |
AbstractCluster(Vector point,
int id2) |
protected |
AbstractCluster(Vector center2,
Vector radius2,
int id2) |
| Modifier and Type | Method and Description |
|---|---|
String |
asFormatString(String[] bindings)
Produce a custom, human-friendly, printable representation of the Cluster.
|
Map<String,Object> |
asJson(String[] bindings)
Produce a JSON representation of the Cluster.
|
Vector |
computeCentroid()
Compute the centroid by averaging the pointTotals
|
void |
computeParameters()
Compute a new set of posterior parameters based upon the Observations that
have been observed since my creation
|
void |
configure(org.apache.hadoop.conf.Configuration job) |
void |
createParameters(String prefix,
org.apache.hadoop.conf.Configuration jobConf)
EXPERT: consumers should never have to call this method.
|
static String |
formatVector(Vector v,
String[] bindings)
Return a human-readable formatted string representation of the vector, not
intended to be complete nor usable as an input/output representation
|
static List<Object> |
formatVectorAsJson(Vector v,
String[] bindings)
Create a List of HashMaps containing vector terms and weights
|
Vector |
getCenter()
Get the "center" of the Cluster as a Vector
|
int |
getId()
Get the id of the Cluster
|
abstract String |
getIdentifier() |
long |
getNumObservations()
Return the number of observations that this model has seen since its
parameters were last computed
|
Collection<Parameter<?>> |
getParameters() |
Vector |
getRadius()
Get the "radius" of the Cluster as a Vector.
|
protected double |
getS0() |
protected Vector |
getS1() |
protected Vector |
getS2() |
long |
getTotalObservations()
Return the number of observations that this model has seen over its
lifetime
|
boolean |
isConverged() |
void |
observe(Model<VectorWritable> x)
Observe the given model, retaining information about its observations
|
void |
observe(Vector x) |
void |
observe(Vector x,
double weight) |
void |
observe(VectorWritable x)
Observe the given observation, retaining information about it
|
void |
observe(VectorWritable x,
double weight)
Observe the given observation, retaining information about it
|
void |
readFields(DataInput in) |
protected void |
setCenter(Vector center) |
protected void |
setId(int id) |
protected void |
setNumObservations(long l) |
protected void |
setRadius(Vector radius) |
protected void |
setS0(double s0) |
protected void |
setS1(Vector s1) |
protected void |
setS2(Vector s2) |
protected void |
setTotalObservations(long totalPoints) |
void |
write(DataOutput out) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpdf, sampleFromPosteriorprotected AbstractCluster()
protected AbstractCluster(Vector point, int id2)
public void write(DataOutput out) throws IOException
write in interface org.apache.hadoop.io.WritableIOExceptionpublic void readFields(DataInput in) throws IOException
readFields in interface org.apache.hadoop.io.WritableIOExceptionpublic void configure(org.apache.hadoop.conf.Configuration job)
configure in interface Parameteredpublic Collection<Parameter<?>> getParameters()
getParameters in interface Parameteredpublic void createParameters(String prefix, org.apache.hadoop.conf.Configuration jobConf)
ParameteredParametered.ParameteredGeneralizations if java supported it. Calling this method should create a new list of
parameters and is calledcreateParameters in interface Parameteredprefix - ends with a dot if not empty.jobConf - configuration used for retrieving valuesinvoking method,
invoking methodpublic int getId()
Clusterprotected void setId(int id)
id - the id to setpublic long getNumObservations()
ModelgetNumObservations in interface Model<VectorWritable>protected void setNumObservations(long l)
l - the numPoints to setpublic long getTotalObservations()
ModelgetTotalObservations in interface Model<VectorWritable>protected void setTotalObservations(long totalPoints)
public Vector getCenter()
Clusterprotected void setCenter(Vector center)
center - the center to setpublic Vector getRadius()
Clusterprotected void setRadius(Vector radius)
radius - the radius to setprotected double getS0()
protected void setS0(double s0)
protected Vector getS1()
protected void setS1(Vector s1)
protected Vector getS2()
protected void setS2(Vector s2)
public void observe(Model<VectorWritable> x)
Modelobserve in interface Model<VectorWritable>x - a Model<0>public void observe(VectorWritable x)
Modelobserve in interface Model<VectorWritable>x - an Observation from the posteriorpublic void observe(VectorWritable x, double weight)
Modelobserve in interface Model<VectorWritable>x - an Observation from the posteriorweight - a double weighting factorpublic void observe(Vector x, double weight)
public void observe(Vector x)
public void computeParameters()
ModelcomputeParameters in interface Model<VectorWritable>public String asFormatString(String[] bindings)
ClusterasFormatString in interface Clusterbindings - an optional String[] containing labels used to format the primary
Vector/s of this implementation.public Map<String,Object> asJson(String[] bindings)
Clusterpublic abstract String getIdentifier()
public Vector computeCentroid()
public static String formatVector(Vector v, String[] bindings)
public static List<Object> formatVectorAsJson(Vector v, String[] bindings) throws IOException
IOExceptionpublic boolean isConverged()
isConverged in interface ClusterCopyright © 2008–2017 The Apache Software Foundation. All rights reserved.