Class ClusteringFactory
java.lang.Object
org.tribuo.clustering.ClusteringFactory
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>,Serializable,OutputFactory<ClusterID>
A factory for making ClusterID related classes.
Parses the ClusterID by calling toString on the input then parsing it as an int.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ClusterIDThe sentinel unassigned cluster id, used when there is no ground truth clustering. -
Constructor Summary
ConstructorsConstructorDescriptionClusteringFactory is stateless and immutable, but we need to be able to construct them via the config system. -
Method Summary
Modifier and TypeMethodDescriptionconstructInfoForExternalModel(Map<ClusterID, Integer> mapping) Unlike the other info types, clustering directly uses the integer IDs as the stored value, so this mapping discards the cluster IDs and just uses the supplied integers.booleanGenerates the appropriateMutableOutputInfoso the output values can be tracked by aDatasetor other aggregate.<V> ClusterIDgenerateOutput(V label) Generates a ClusterID by calling toString on the input, then calling Integer.parseInt.Gets anEvaluatorsuitable for measuring performance of predictions for the Output subclass.Returns the singleton unknown output of type T which can be used for prediction time examples.inthashCode()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfigMethods inherited from interface org.tribuo.OutputFactory
generateOutputs
-
Field Details
-
UNASSIGNED_CLUSTER_ID
The sentinel unassigned cluster id, used when there is no ground truth clustering.
-
-
Constructor Details
-
ClusteringFactory
public ClusteringFactory()ClusteringFactory is stateless and immutable, but we need to be able to construct them via the config system.
-
-
Method Details
-
generateOutput
Generates a ClusterID by calling toString on the input, then calling Integer.parseInt.- Specified by:
generateOutputin interfaceOutputFactory<ClusterID>- Type Parameters:
V- The type of the input.- Parameters:
label- An input value.- Returns:
- A ClusterID representing the data.
-
getUnknownOutput
Description copied from interface:OutputFactoryReturns the singleton unknown output of type T which can be used for prediction time examples.- Specified by:
getUnknownOutputin interfaceOutputFactory<ClusterID>- Returns:
- An unknown output.
-
generateInfo
Description copied from interface:OutputFactoryGenerates the appropriateMutableOutputInfoso the output values can be tracked by aDatasetor other aggregate.- Specified by:
generateInfoin interfaceOutputFactory<ClusterID>- Returns:
- The appropriate subclass of
MutableOutputInfoinitialised to zero.
-
constructInfoForExternalModel
public ImmutableOutputInfo<ClusterID> constructInfoForExternalModel(Map<ClusterID, Integer> mapping) Unlike the other info types, clustering directly uses the integer IDs as the stored value, so this mapping discards the cluster IDs and just uses the supplied integers.- Specified by:
constructInfoForExternalModelin interfaceOutputFactory<ClusterID>- Parameters:
mapping- The mapping to use.- Returns:
- An
ImmutableOutputInfofor the clustering.
-
getEvaluator
Description copied from interface:OutputFactoryGets anEvaluatorsuitable for measuring performance of predictions for the Output subclass.Evaluatorinstances are thread safe and immutable, and commonly this is a singleton stored in theOutputFactoryimplementation.- Specified by:
getEvaluatorin interfaceOutputFactory<ClusterID>- Returns:
- An evaluator.
-
hashCode
-
equals
-
getProvenance
- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>
-