public abstract class AbstractCluster extends Object implements Cluster
Parametered.ParameteredGeneralizations
CLUSTERS_DIR, FINAL_ITERATION_SUFFIX, INITIAL_CLUSTERS_DIR
log
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, wait
pdf, sampleFromPosterior
protected AbstractCluster()
protected AbstractCluster(Vector point, int id2)
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void configure(org.apache.hadoop.conf.Configuration job)
configure
in interface Parametered
public Collection<Parameter<?>> getParameters()
getParameters
in interface Parametered
public void createParameters(String prefix, org.apache.hadoop.conf.Configuration jobConf)
Parametered
Parametered.ParameteredGeneralizations
if java supported it. Calling this method should create a new list of
parameters and is calledcreateParameters
in interface Parametered
prefix
- ends with a dot if not empty.jobConf
- configuration used for retrieving valuesinvoking method
,
invoking method
public int getId()
Cluster
protected void setId(int id)
id
- the id to setpublic long getNumObservations()
Model
getNumObservations
in interface Model<VectorWritable>
protected void setNumObservations(long l)
l
- the numPoints to setpublic long getTotalObservations()
Model
getTotalObservations
in interface Model<VectorWritable>
protected void setTotalObservations(long totalPoints)
public Vector getCenter()
Cluster
protected void setCenter(Vector center)
center
- the center to setpublic Vector getRadius()
Cluster
protected 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)
Model
observe
in interface Model<VectorWritable>
x
- a Model<0>public void observe(VectorWritable x)
Model
observe
in interface Model<VectorWritable>
x
- an Observation from the posteriorpublic void observe(VectorWritable x, double weight)
Model
observe
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()
Model
computeParameters
in interface Model<VectorWritable>
public String asFormatString(String[] bindings)
Cluster
asFormatString
in interface Cluster
bindings
- an optional String[] containing labels used to format the primary
Vector/s of this implementation.public Map<String,Object> asJson(String[] bindings)
Cluster
public 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
IOException
public boolean isConverged()
isConverged
in interface Cluster
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.