Package org.tribuo.clustering.hdbscan
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.
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*
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Available distance functions. -
Field Summary
Fields inherited from interface org.tribuo.Trainer
DEFAULT_SEED, INCREMENT_INVOCATION_COUNT
-
Constructor Summary
ConstructorDescriptionHdbscanTrainer
(int minClusterSize) Constructs an HDBSCAN* trainer with only the minClusterSize parameter.HdbscanTrainer
(int minClusterSize, HdbscanTrainer.Distance distanceType, int k, int numThreads) Constructs an HDBSCAN* trainer using the supplied parameters. -
Method Summary
Modifier and TypeMethodDescriptionint
The number of times this trainer instance has had it's train method invoked.void
setInvocationCount
(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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
-
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.distanceType
defaults toHdbscanTrainer.Distance.EUCLIDEAN
,k
defaults tominClusterSize
, andnumThreads
defaults to 1.
-
HdbscanTrainer
public HdbscanTrainer(int minClusterSize, HdbscanTrainer.Distance distanceType, int k, int numThreads) Constructs an HDBSCAN* trainer using the supplied parameters.- 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.
-
-
Method Details
-
train
public HdbscanModel train(Dataset<ClusterID> examples, Map<String, com.oracle.labs.mlrg.olcut.provenance.Provenance> runProvenance) Description copied from interface:Trainer
Trains a predictive model using the examples in the given data set. -
train
Description copied from interface:Trainer
Trains a predictive model using the examples in the given data set. -
getInvocationCount
public int getInvocationCount()Description copied from interface:Trainer
The 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:
getInvocationCount
in interfaceTrainer<ClusterID>
- Returns:
- The number of train invocations.
-
setInvocationCount
public void setInvocationCount(int newInvocationCount) Description copied from interface:Trainer
Set 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:
setInvocationCount
in interfaceTrainer<ClusterID>
- Parameters:
newInvocationCount
- the number of invocations of the train method to simulate
-
toString
-
getProvenance
- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>
-