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>

public final class HdbscanTrainer extends Object implements 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*
 
  • 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 to HdbscanTrainer.Distance.EUCLIDEAN, k defaults to minClusterSize, and numThreads 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.
      Specified by:
      train in interface Trainer<ClusterID>
      Parameters:
      examples - the data set containing the examples.
      runProvenance - Training run specific provenance (e.g., fold number).
      Returns:
      a predictive model that can be used to generate predictions for new examples.
    • train

      public HdbscanModel train(Dataset<ClusterID> dataset)
      Description copied from interface: Trainer
      Trains a predictive model using the examples in the given data set.
      Specified by:
      train in interface Trainer<ClusterID>
      Parameters:
      dataset - the data set containing the examples.
      Returns:
      a predictive model that can be used to generate predictions for new examples.
    • 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 interface Trainer<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 interface Trainer<ClusterID>
      Parameters:
      newInvocationCount - the number of invocations of the train method to simulate
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getProvenance

      public TrainerProvenance getProvenance()
      Specified by:
      getProvenance in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<TrainerProvenance>