Class ClusterID
java.lang.Object
org.tribuo.clustering.ClusterID
- All Implemented Interfaces:
Serializable,Output<ClusterID>
A clustering id.
The id is an int, referring to a cluster stored in the model. Optionally contains a score representing the strength of association with that cluster, if available.
The id is UNASSIGNED if the output is not assigned to a
cluster (e.g., before the Model has been trained).
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClusterID(int id) Creates a ClusterID with the sentinel score ofDouble.NaN.ClusterID(int id, double score) Creates a ClusterID with the specified id number and score. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Deep copy of the output up to it's immutable state.booleanbooleanCompares other to this output.intgetID()Gets the cluster id number.doublegetScore()Get a real valued score for this ClusterID.getSerializableForm(boolean includeConfidence) Returns "id" or "id,score=idScore".inthashCode()toString()
-
Field Details
-
UNASSIGNED
public static final int UNASSIGNEDThe sentinel unassigned cluster ID.- See Also:
-
-
Constructor Details
-
ClusterID
public ClusterID(int id) Creates a ClusterID with the sentinel score ofDouble.NaN.- Parameters:
id- The cluster id number.
-
ClusterID
public ClusterID(int id, double score) Creates a ClusterID with the specified id number and score.- Parameters:
id- The cluster id number.score- The score.
-
-
Method Details
-
getScore
public double getScore()Get a real valued score for this ClusterID.If the score is not set then it returns Double.NaN.
- Returns:
- The predicted score for this cluster id.
-
getID
public int getID()Gets the cluster id number.- Returns:
- A int.
-
equals
-
hashCode
-
fullEquals
Description copied from interface:OutputCompares other to this output. Uses all score values and the strings.- Specified by:
fullEqualsin interfaceOutput<ClusterID>- Parameters:
o- Another output instance.- Returns:
- True if the other instance has value equality to this instance. False otherwise.
-
toString
-
copy
-
getSerializableForm
Returns "id" or "id,score=idScore".- Specified by:
getSerializableFormin interfaceOutput<ClusterID>- Parameters:
includeConfidence- Include whatever confidence score the clusterID contains, if known.- Returns:
- A string representing this ClusterID, suitable for csv or json serialization.
-