Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2026.0.0 - 日本語


estimate_bandwidth

Estimate an appropriate bandwidth for Mean Shift clustering

Syntax

bw = estimate_bandwidth(X [, quantile, n_samples, random_state])

Arguments

X

is a N x D (N samples, D features) real matrix.

quantile

real scalar, optional (default=0.3). Quantile to compute the distance bandwidth. A smaller quantile gives a smaller bandwidth, leading to more clusters. A larger quantile produces a larger bandwidth, leading to fewer clusters.

n_samples

integer, optional (default=min(500, N)). Number of samples to randomly select for bandwidth estimation. If n_samples > size(data,1), all samples are used.

random_state

integer, optional (default=-1). Seed for random sampling reproducibility.

bw

real scalar. Estimated bandwidth parameter suitable for Mean Shift clustering. Typically corresponds to a quantile of pairwise distances between points.

Description

estimate_bandwidth computes a bandwidth value from a dataset, which can be used as the bandwidth parameter in meanshift.

Note that:

  • Smaller quantile → smaller bandwidth → more clusters.

  • Larger quantile → larger bandwidth → fewer clusters.

Examples

X = [0 0; 0 1; 1 0; 5 5; 5 6; 6 5; 9 9; 9 10; 10 9];
bw = estimate_bandwidth(X);

[centers, labels] = meanshift(X, bw);
scf(); 
scatter(X(:,1), X(:,2), [], labels, "fill");
plot(centers(:,1), centers(:,2), 'r*', "markersize", 10, "thickness", 3);
gca().data_bounds = [-1 -1; 11 11];

See also

  • meanshift — Mean Shift clustering algorithm
  • kmeans — K-means clustering

History

バージョン記述
2026.0.0 Function added.
Report an issue
<< dbscan Statistics kmeans >>

Copyright (c) 2022-2025 (Dassault Systèmes S.E.)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 16 09:20:58 CEST 2025