Sklearn Spectral Clustering icon

Sklearn Spectral Clustering

Graph-based spectral clustering using scikit-learn

Sklearn Spectral Clustering

AI-generated

Summary

Cluster input rows using scikit-learn Spectral Clustering based on specified feature columns.

Inputs

  • featureColumns (required) — Comma-separated list of feature column names
  • nClusters — Number of clusters to find
  • affinity — How to construct the affinity matrix
  • nNeighbors — Number of neighbors for nearest_neighbors affinity
  • randomState — Random seed for reproducibility
  • pythonPath — Path to Python executable with scikit-learn installed

Output shape

a list of items, each extending the original record with 'cluster' (cluster label) and 'n_clusters' (the chosen number of clusters)

Adds 'cluster' and 'n_clusters' fields; on Python execution failure with continueOnFail enabled an 'error' field may appear, otherwise the operation throws.

Examples

Example 1: Cluster a dataset with three numeric columns using default RBF affinity and 2 clusters

featureColumns: 'col1,col2,col3', nClusters: 2, affinity: 'rbf'

Example 2: Use precomputed affinity with 5 neighbors

featureColumns: 'x,y', affinity: 'precomputed', nNeighbors: 5

Example 3: Run with custom Python path and random state 123

pythonPath: '/usr/bin/python3.9', randomState: 123

Discussion