|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.cluster.SimpleCluster
A simple implementation of Cluster. Warning: Does not initialize Arrays pr_w_z and pr_d_z upon construction Subclasses should have constructor initialize Arrays pr_w_z and pr_d_z
Field Summary | |
protected int |
index
cluster index |
protected Array |
mean
weighted mean of datum in cluster |
protected int |
nd
number of data |
protected int |
nt
number of features |
protected Array |
pr_d_z
P(d|z) for a set of w: Probability distribution of data over cluster |
protected Array |
pr_w_z
P(w|z) for a set of w: Probability distribution of features over cluster |
protected double |
pr_z
P(z): Probability of given cluster |
protected double |
scatter
scatter value of data in cluster. |
Constructor Summary | |
SimpleCluster(double prz,
Array prwz,
Array prdz,
int i)
|
|
SimpleCluster(int num_features,
int num_data)
|
|
SimpleCluster(int num_features,
int num_data,
int i)
|
Method Summary | |
void |
clearData()
Dets the value for all data in cluster = 0 |
Object |
clone()
Returns deep copy of Cluster |
boolean |
equals(Object o)
Implements equality test. |
double |
evaluateIntraSimilarity(Matrix m,
Array mean)
Evaluates the cohesiveness of Cluster A low value reflects a cohesive cluster, and a high value reflects a scattered cluster; |
Array |
evaluateWeightedMean(Matrix m)
Evaluates weighted mean of columns in Matrix m. |
Array |
get_pr_d_z()
Returns entire probabilitiy distribution P(w|z) |
double |
get_pr_d_z(int datum_index)
Returns P(d|z) for d=datum_index |
Array |
get_pr_w_z()
Returns entire probability distribution P(w|z) |
double |
get_pr_w_z(int feature_index)
Returns P(w|z) for w=feature_index |
double |
get_pr_z()
Returns P(z) |
int |
getIndex()
Returns cluster's index |
double |
getIntraSimilarity()
Returns scatter value of Cluster, if it has already been computed |
Array |
getMean()
Returns weighted mean of Cluster, if it has already been computed |
void |
set_pr_d_z(Array prdz)
Sets entire P(d|z) array to prdz |
void |
set_pr_d_z(int datum_index,
double value)
Sets P(d|z) for d= datum_index to value
P(d|z) is the probability of datum d, given this cluster |
void |
set_pr_w_z(Array prwz)
Sets entire P(w|z) array to prwz |
void |
set_pr_w_z(int feature_index,
double value)
Sets P(w|z) for w= feature_index to value
P(w|z) is the probability of feature w, given this cluster |
void |
set_pr_z(double value)
Sets P(z) to value
P(z) is the cluster probability, or cluster weight |
void |
setIndex(int i)
Sets cluster index to i |
String |
toString(DataCollection dbm)
Returns String representation of Cluster prints default number of features and data. |
String |
toString(int tnf,
int tnd,
DataCollection dbm)
Returns String representation of Cluster |
String |
toXMLString(DataCollection dbm)
Returns XML String representation of Cluster prints default number of features and data. |
String |
toXMLString(int tnf,
int tnd,
DataCollection dbm)
Returns XML String representation of Cluster |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int index
protected double scatter
scatter
will be high.
protected Array mean
protected double pr_z
protected Array pr_w_z
protected Array pr_d_z
protected int nt
protected int nd
Constructor Detail |
public SimpleCluster(int num_features, int num_data)
public SimpleCluster(int num_features, int num_data, int i)
public SimpleCluster(double prz, Array prwz, Array prdz, int i)
Method Detail |
public void set_pr_z(double value)
Cluster
value
P(z) is the cluster probability, or cluster weight
set_pr_z
in interface Cluster
public void set_pr_w_z(int feature_index, double value)
Cluster
feature_index
to value
P(w|z) is the probability of feature w, given this cluster
set_pr_w_z
in interface Cluster
public void set_pr_w_z(Array prwz)
Cluster
P(w|z)
array to prwz
set_pr_w_z
in interface Cluster
public void set_pr_d_z(int datum_index, double value)
Cluster
datum_index
to value
P(d|z) is the probability of datum d, given this cluster
set_pr_d_z
in interface Cluster
public void set_pr_d_z(Array prdz)
Cluster
P(d|z)
array to prdz
set_pr_d_z
in interface Cluster
public void setIndex(int i)
Cluster
setIndex
in interface Cluster
public double get_pr_z()
Cluster
get_pr_z
in interface Cluster
public double get_pr_w_z(int feature_index)
Cluster
get_pr_w_z
in interface Cluster
public Array get_pr_w_z()
Cluster
get_pr_w_z
in interface Cluster
public double get_pr_d_z(int datum_index)
Cluster
get_pr_d_z
in interface Cluster
public Array get_pr_d_z()
Cluster
get_pr_d_z
in interface Cluster
public int getIndex()
Cluster
getIndex
in interface Cluster
public String toXMLString(int tnf, int tnd, DataCollection dbm)
Cluster
toXMLString
in interface Cluster
tnf
- top n features. prints top tnf
features with largest probabilitiestnd
- top n datums. prints top tnd
datums with largest probabilitiespublic String toXMLString(DataCollection dbm)
Cluster
toXMLString
in interface Cluster
public String toString(int tnf, int tnd, DataCollection dbm)
Cluster
toString
in interface Cluster
tnf
- top n features. prints top tnf
features with largest probabilitiestnd
- top n datums. prints top tnd
datums with largest probabilitiespublic String toString(DataCollection dbm)
Cluster
toString
in interface Cluster
public Object clone()
Cluster
clone
in interface Cluster
clone
in class Object
public boolean equals(Object o)
Cluster
o==this
, and false if o!=this
.
equals
in interface Cluster
equals
in class Object
public Array evaluateWeightedMean(Matrix m)
Cluster
evaluateWeightedMean
in interface Cluster
public double evaluateIntraSimilarity(Matrix m, Array mean)
Cluster
evaluateIntraSimilarity
in interface Cluster
public double getIntraSimilarity()
Cluster
getIntraSimilarity
in interface Cluster
public Array getMean()
Cluster
getMean
in interface Cluster
public void clearData()
Cluster
clearData
in interface Cluster
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |