Class HdbscanTrainer
java.lang.Object
org.tribuo.clustering.hdbscan.HdbscanTrainer
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>,Trainer<ClusterID>
An HDBSCAN* trainer which generates a hierarchical, density-based clustering representation
of the supplied data.
The cluster assignments and outlier scores can be retrieved from the model after training. Outliers or noise points are assigned the label 0.
For the HDBSCAN* algorithm see:
R.J.G.B. Campello, D. Moulavi, A. Zimek and J. Sander "Hierarchical Density Estimates for Data Clustering, Visualization, and Outlier Detection", ACM Trans. on Knowledge Discovery from Data, Vol 10, 1 (July 2015), 1-51. HDBSCAN*
For this specific implementation and prediction technique, see:
G. Stewart, M. Al-Khassaweneh. "An Implementation of the HDBSCAN* Clustering Algorithm", Applied Sciences. 2022; 12(5):2405. Manuscript
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA cluster exemplar, with attributes for the point's label, outlier score and its features.static enumDeprecated. -
Field Summary
Fields inherited from interface org.tribuo.Trainer
DEFAULT_SEED, INCREMENT_INVOCATION_COUNT -
Constructor Summary
ConstructorsConstructorDescriptionHdbscanTrainer(int minClusterSize) Constructs an HDBSCAN* trainer with only the minClusterSize parameter.HdbscanTrainer(int minClusterSize, int k, NeighboursQueryFactory neighboursQueryFactory) Constructs an HDBSCAN* trainer using the supplied parameters.HdbscanTrainer(int minClusterSize, HdbscanTrainer.Distance distanceType, int k, int numThreads) Deprecated.This Constructor is deprecated in version 4.3.HdbscanTrainer(int minClusterSize, Distance dist, int k, int numThreads, NeighboursQueryFactoryType nqFactoryType) Constructs an HDBSCAN* trainer using the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptionintThe number of times this trainer instance has had it's train method invoked.voidUsed by the OLCUT configuration system, and should not be called by external code.voidsetInvocationCount(int newInvocationCount) Set the internal state of the trainer to the provided number of invocations of the train method.toString()Trains a predictive model using the examples in the given data set.train(Dataset<ClusterID> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) Trains a predictive model using the examples in the given data set.
-
Constructor Details
-
HdbscanTrainer
public HdbscanTrainer(int minClusterSize) Constructs an HDBSCAN* trainer with only the minClusterSize parameter.- Parameters:
minClusterSize- The minimum number of points required to form a cluster.distdefaults toDistanceType.L2,kdefaults tominClusterSize,numThreadsdefaults to 1 andneighboursQueryFactorydefaults toNeighboursBruteForceFactory.
-
HdbscanTrainer
@Deprecated public HdbscanTrainer(int minClusterSize, HdbscanTrainer.Distance distanceType, int k, int numThreads) Deprecated.This Constructor is deprecated in version 4.3.Constructs an HDBSCAN* trainer using the supplied parameters.neighboursQueryFactorydefaults toNeighboursBruteForceFactory.- Parameters:
minClusterSize- The minimum number of points required to form a cluster.distanceType- The distance function.k- The number of nearest-neighbors to use in the initial density approximation.numThreads- The number of threads.
-
HdbscanTrainer
public HdbscanTrainer(int minClusterSize, Distance dist, int k, int numThreads, NeighboursQueryFactoryType nqFactoryType) Constructs an HDBSCAN* trainer using the supplied parameters.- Parameters:
minClusterSize- The minimum number of points required to form a cluster.dist- The distance function.k- The number of nearest-neighbors to use in the initial density approximation.numThreads- The number of threads.nqFactoryType- The nearest neighbour query implementation factory to use.
-
HdbscanTrainer
Constructs an HDBSCAN* trainer using the supplied parameters.- Parameters:
minClusterSize- The minimum number of points required to form a cluster.k- The number of nearest-neighbors to use in the initial density approximation.neighboursQueryFactory- The nearest neighbour query implementation factory to use.
-
-
Method Details
-
postConfig
public void postConfig()Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfigin interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
train
-
train
Description copied from interface:TrainerTrains a predictive model using the examples in the given data set. -
getInvocationCount
public int getInvocationCount()Description copied from interface:TrainerThe number of times this trainer instance has had it's train method invoked.This is used to determine how many times the trainer's RNG has been accessed to ensure replicability in the random number stream.
- Specified by:
getInvocationCountin interfaceTrainer<ClusterID>- Returns:
- The number of train invocations.
-
setInvocationCount
public void setInvocationCount(int newInvocationCount) Description copied from interface:TrainerSet the internal state of the trainer to the provided number of invocations of the train method.This is used when reproducing a Tribuo-trained model by setting the state of the RNG to what it was at when Tribuo trained the original model by simulating invocations of the train method. This method should ALWAYS be overridden, and the default method is purely for compatibility.
In a future major release this default implementation will be removed.
- Specified by:
setInvocationCountin interfaceTrainer<ClusterID>- Parameters:
newInvocationCount- the number of invocations of the train method to simulate
-
toString
-
getProvenance
- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
-
DistanceType