public class Cluster
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected Prototype |
centroid
Centroid/Center of the cluster.
|
protected double |
label
Class of all the prototypes of the Cluster.
|
protected PrototypeSet |
set
Set of prototypes (minus the center) that forms the cluster.
|
Constructor and Description |
---|
Cluster(Prototype centroid,
PrototypeSet set)
Construct a new cluster.
|
Cluster(PrototypeSet set,
Prototype centroid)
Construct a new cluster.
|
Modifier and Type | Method and Description |
---|---|
Pair<Cluster,Cluster> |
_2LBGPartition(double epsilon)
Part the cluster by the LBG method.
|
void |
add(Prototype t)
Add one element to the cluster.
|
Prototype |
avg()
Computes the average prototype of the cluster.
|
Prototype |
center()
Returns the center of the cluster.
|
Pair<Prototype,Prototype> |
centersOfLBGCLuster(double epsilon)
Returns the centers of the cluster obtained by LBG method.
|
protected static double |
distorsion(Pair<Prototype,Prototype> centers,
Pair<Cluster,Cluster> part)
Distorsion of two sets, given two centers.
|
protected double |
distorsion(Prototype center)
Distorsion of the cluster (sum of distances of the prototypes to the center).
|
double |
fitness()
Returns the Medium Squared Error of the cluster.
|
Prototype |
get(int i)
Get one element of the cluster.
|
Prototype |
getCentroid()
Returns the center of the cluster.
|
double |
getLabel()
Get the class of the cluster.
|
PrototypeSet |
getPrototypeSet()
Get the elements of the cluster.
|
boolean |
isCentroidItsNearestPrototoype(Prototype p)
Informs if the centroid of the cluster is its nearest prototype.
|
protected Pair<Cluster,Cluster> |
partititonWhoseCentersAre(Prototype center1,
Prototype center2)
Use the nearest neighbor condition to make a partition in two cluster which have got this centers.
|
void |
setCentroid(Prototype centroid)
Asssigns the center of the cluster.
|
void |
setLabel(double label)
Asssigns the class of the cluster.
|
void |
setSet(PrototypeSet set)
Asssigns the set of prototypes of the cluster.
|
int |
size()
Returns the size of the cluster.
|
protected Prototype centroid
protected PrototypeSet set
protected double label
public Cluster(Prototype centroid, PrototypeSet set)
centroid
- Centroid of the cluster.set
- Set of the cluster.public Cluster(PrototypeSet set, Prototype centroid)
set
- Set of the cluster.centroid
- Centroid of the cluster.public void setCentroid(Prototype centroid)
centroid
- New center of the cluster.public void setLabel(double label)
label
- New label of the cluster.public void setSet(PrototypeSet set)
set
- New set of the cluster.public double getLabel()
public PrototypeSet getPrototypeSet()
public void add(Prototype t)
t
- New prototype to be added to the cluster.public Prototype get(int i)
i
- Index of the element to be returned.public Prototype center()
public Prototype getCentroid()
public double fitness()
public Prototype avg()
public int size()
protected Pair<Cluster,Cluster> partititonWhoseCentersAre(Prototype center1, Prototype center2)
center1
- Center of the first set.center2
- Center of the second set.protected double distorsion(Prototype center)
center
- cluster center.protected static double distorsion(Pair<Prototype,Prototype> centers, Pair<Cluster,Cluster> part)
centers
- Centers of the pair of clusters.part
- Clusters.public Pair<Cluster,Cluster> _2LBGPartition(double epsilon)
epsilon
- Maximum error tolerated.public Pair<Prototype,Prototype> centersOfLBGCLuster(double epsilon)
epsilon
- Maximum error tolerated.public boolean isCentroidItsNearestPrototoype(Prototype p)
p
- Prototype to be tested.