Package moa.cluster
Class SphereCluster
- java.lang.Object
-
- moa.AbstractMOAObject
-
- moa.cluster.Cluster
-
- moa.cluster.SphereCluster
-
- All Implemented Interfaces:
Serializable
,MOAObject
- Direct Known Subclasses:
CFCluster
,ClusteringFeature
public class SphereCluster extends Cluster
A simple implementation of theCluster
interface representing spherical clusters. The inclusion probability is one inside the sphere and zero everywhere else.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SphereCluster()
SphereCluster(double[] center, double radius)
SphereCluster(double[] center, double radius, double weightedSize)
SphereCluster(int dimensions, double radius, Random random)
SphereCluster(List<? extends Instance> instances, int dimension)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
combine(SphereCluster cluster)
double[]
getCenter()
double
getCenterDistance(Instance instance)
double
getCenterDistance(SphereCluster other)
protected void
getClusterSpecificInfo(ArrayList<String> infoTitle, ArrayList<String> infoValue)
double[]
getDistanceVector(Instance instance)
double[]
getDistanceVector(SphereCluster other)
double
getHullDistance(SphereCluster other)
double
getInclusionProbability(Instance instance)
Returns the probability of the given point belonging to this cluster.double
getRadius()
double
getWeight()
Returns the weight of this cluster, not neccessarily normalized.void
merge(SphereCluster cluster)
double
overlapRadiusDegree(SphereCluster other)
Checks whether twoSphereCluster
overlap based on radius NOTE: overlapRadiusDegree only calculates the overlap based on the centers and the radi, so not the real overlap TODO: should we do this by MC to get the real overlap???boolean
overlapSave(SphereCluster other)
When a clusters looses points the new minimal bounding sphere can be partly outside of the originating cluster.Instance
sample(Random random)
Samples this cluster by returning a point from inside it.void
setCenter(double[] center)
void
setRadius(double radius)
void
setWeight(double weight)
-
Methods inherited from class moa.cluster.Cluster
getDescription, getGroundTruth, getId, getInfo, getMeasureValue, isGroundTruth, setGroundTruth, setId, setMeasureValue, setMeasureValue
-
Methods inherited from class moa.AbstractMOAObject
copy, copy, measureByteSize, measureByteSize, toString
-
-
-
-
Constructor Detail
-
SphereCluster
public SphereCluster(double[] center, double radius)
-
SphereCluster
public SphereCluster()
-
SphereCluster
public SphereCluster(double[] center, double radius, double weightedSize)
-
SphereCluster
public SphereCluster(int dimensions, double radius, Random random)
-
-
Method Detail
-
overlapRadiusDegree
public double overlapRadiusDegree(SphereCluster other)
Checks whether twoSphereCluster
overlap based on radius NOTE: overlapRadiusDegree only calculates the overlap based on the centers and the radi, so not the real overlap TODO: should we do this by MC to get the real overlap???- Parameters:
other
-- Returns:
-
combine
public void combine(SphereCluster cluster)
-
merge
public void merge(SphereCluster cluster)
-
getCenter
public double[] getCenter()
-
setCenter
public void setCenter(double[] center)
-
getRadius
public double getRadius()
-
setRadius
public void setRadius(double radius)
-
getWeight
public double getWeight()
Description copied from class:Cluster
Returns the weight of this cluster, not neccessarily normalized. It could, for instance, simply return the number of points contined in this cluster.
-
setWeight
public void setWeight(double weight)
-
getInclusionProbability
public double getInclusionProbability(Instance instance)
Description copied from class:Cluster
Returns the probability of the given point belonging to this cluster.- Specified by:
getInclusionProbability
in classCluster
- Returns:
- a value between 0 and 1
-
getCenterDistance
public double getCenterDistance(Instance instance)
-
getCenterDistance
public double getCenterDistance(SphereCluster other)
-
getHullDistance
public double getHullDistance(SphereCluster other)
-
overlapSave
public boolean overlapSave(SphereCluster other)
When a clusters looses points the new minimal bounding sphere can be partly outside of the originating cluster. If a another cluster is right next to the original cluster (without overlapping), the new cluster can be overlapping with this second cluster. OverlapSave will tell you if the current cluster can degenerate so much that it overlaps with cluster 'other'- Parameters:
other
- the potentially overlapping cluster- Returns:
- true if cluster can potentially overlap
-
getDistanceVector
public double[] getDistanceVector(Instance instance)
-
getDistanceVector
public double[] getDistanceVector(SphereCluster other)
-
sample
public Instance sample(Random random)
Samples this cluster by returning a point from inside it.
-
-