Skip to contents

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

Super classes

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

Methods

Inherited methods


Method new()

The MeanShift class constructor.

Usage

MeanShift$new(
  bandwidth = NULL,
  seeds = NULL,
  bin_seeding = FALSE,
  min_bin_freq = 1L,
  cluster_all = TRUE,
  n_jobs = 1L,
  max_iter = 300L
)

Arguments

bandwidth

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.

seeds

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.

bin_seeding

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.

min_bin_freq

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.

cluster_all

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.

n_jobs

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.

max_iter

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.

Returns

An object of class MeanShift.


Method clone()

The objects of this class are cloneable with this method.

Usage

MeanShift$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

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