Skip to contents

This is a wrapper around the Python class sklearn.cluster.MeanShift.

Super classes

rgudhi::PythonClass -> rgudhi::SKLearnClass -> rgudhi::BaseClustering -> MeanShift


Inherited methods

Method new()

The MeanShift class constructor.


  bandwidth = NULL,
  seeds = NULL,
  bin_seeding = FALSE,
  min_bin_freq = 1L,
  cluster_all = TRUE,
  n_jobs = 1L,
  max_iter = 300L



A numeric value specifying the bandwidth used in the RBF kernel. If NULL, the bandwidth is estimated using sklearn.cluster.estimate_bandwidth(). Defaults to NULL.


A numeric matrix of shape \(n_\mathrm{samples} \times n_\mathrm{features}\) specifying the seeds used to initialize kernels. If NULL, the seeds are calculated by sklearn.cluster.get_bin_seeds() with bandwidth as the grid size and default values for other parameters. Defaults to NULL.


A boolean value specifying whether initial kernel locations are not locations of all points, but rather the location of the discretized version of points, where points are binned onto a grid whose coarseness corresponds to the bandwidth. Setting this option to TRUE will speed up the algorithm because fewer seeds will be initialized. Defaults to FALSE. Ignored if seeds is not NULL.


An integer value specifying the minimal size of bins. To speed up the algorithm, accept only those bins with at least min_bin_freq points as seeds. Defaults to 1L.


A boolean value specifying whether all points are clustered, even those orphans that are not within any kernel. Orphans are assigned to the nearest kernel. If FALSE, then orphans are given cluster label -1. Defaults to TRUE.


An integer value specifying the number of jobs to use for the computation. This works by computing each of the n_init runs in parallel. Defaults to 1L.


An integer value specifying the maximum number of iterations per seed point before the clustering operation terminates (for that seed point) if it has not yet converged. Defaults to 300L.


An object of class MeanShift.

Method clone()

The objects of this class are cloneable with this method.


MeanShift$clone(deep = FALSE)



Whether to make a deep clone.


if (FALSE) { # reticulate::py_module_available("sklearn.cluster")
cl <- MeanShift$new()