geosnap.analyze.analytics.spectral¶
-
geosnap.analyze.analytics.
spectral
(X, n_clusters, eigen_solver=None, random_state=None, n_init=10, gamma=1.0, affinity='rbf', n_neighbors=10, eigen_tol=0.0, assign_labels='kmeans', degree=3, coef0=1, kernel_params=None, n_jobs=-1, **kwargs)[source]¶ Spectral Clustering.
- Parameters
- Xarray_like
n x k attribute data
- n_clusters
int
The number of clusters to form as well as the number of centroids to generate.
- eigen_solver{
None
, ‘arpack’, ‘lobpcg’, or ‘amg’} The eigenvalue decomposition strategy to use. AMG requires pyamg to be installed. It can be faster on very large, sparse problems, but may also lead to instabilities.
- n_components
integer
, optional, default=n_clusters Number of eigen vectors to use for the spectral embedding
- random_state
int
,RandomState
instance orNone
(default) A pseudo random number generator used for the initialization of the lobpcg eigen vectors decomposition when eigen_solver=’amg’ and by the K-Means initialization. Use an int to make the randomness deterministic. See Glossary.
- n_init
int
, optional, default: 10 Number of time the k-means algorithm will be run with different centroid seeds. The final results will be the best output of n_init consecutive runs in terms of inertia.
- gamma
float
, default=1.0 Kernel coefficient for rbf, poly, sigmoid, laplacian and chi2 kernels. Ignored for affinity=’nearest_neighbors’.
- affinity
str
orcallable()
, default ‘rbf’ How to construct the affinity matrix.
- n_neighbors
integer
Number of neighbors to use when constructing the affinity matrix using the nearest neighbors method. Ignored for affinity=’rbf’.
- eigen_tol
float
, optional, default: 0.0 Stopping criterion for eigendecomposition of the Laplacian matrix when eigen_solver=’arpack’.
- degree
float
, default=3 Degree of the polynomial kernel. Ignored by other kernels.
- coef0
float
, default=1 Zero coefficient for polynomial and sigmoid kernels. Ignored by other kernels.
- n_jobs
int
orNone
, optional (default=None) The number of parallel jobs to run. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. See Glossary for more details.
- **kwargs
dict
additional wkargs.
- Returns
- fitted cluster instance
sklearn.cluster.SpectralClustering
- fitted cluster instance