Spectral, Distribution-Aware and Dynamic-Programming Clustering

Provides dynamic-programming clustering methods for one or more variables. For one variable, the package finds the globally optimal contiguous partition for the stated objective. Multivariate methods use projection, separating directions, sequence order, graph structure, or spectral unfolding. The main method is Spectral Mathematical Programming Dynamic Programming clustering, or S-MPDP. It unfolds non-convex data into one ordered signal and places cluster boundaries with a distribution-aware dynamic program. The package also provides cluster diagnostics, stability analysis, evaluation metrics, comparison methods, benchmark datasets, and base or 'ggplot2' figures. The distribution-aware dynamic-programming component follows Khan, Khan and Ahsan (2002) , Reddy and Khan (2018) , and Reddy and Khan (2020) . The exact one-dimensional clustering comparison follows Wang and Song (2011) . The spectral graph component builds on Shi and Malik (2000) , Ng, Jordan and Weiss (2002) < https://papers.nips.cc/paper/2092-on-spectral-clustering-analysis-and-an-algorithm>, and Zelnik-Manor and Perona (2004) < https://papers.nips.cc/paper/2619-self-tuning-spectral-clustering>.


clusta

Spectral, distribution-aware, and dynamic-programming clustering in R.

clusta provides a family of clustering methods built around dynamic programming. When observations can be placed on an ordered axis, the package finds the best contiguous partition for the stated objective. It also provides structured methods for multivariate data.

The main method is S-MPDP, or Spectral Mathematical Programming Dynamic Programming clustering. It is designed for multivariate groups with complex shapes, including rings, spirals, and crescents.

Install

install.packages("clusta_1.0-1.tar.gz", repos = NULL, type = "source")

The core package requires fitdistrplus. Optional packages provide extra figures, metrics, comparison methods, and the Shiny app.

Quick start

library(clusta)

data(ceramic)
X <- ceramic[, setdiff(names(ceramic), "class")]

res <- spectral_mpdp(X, h = 2, k_neighbors = 41)
res
summary(res)

cluster_metrics(X, ceramic$class, res$cluster_results$cluster)

Six standard figures are available in base graphics. Matching ggplot2 figures are also available when ggplot2 is installed.

plot(res, "clusters")
plot(res, "signal")
plot(res, "confidence")
plot(res, "eigengap")
plot(res, "similarity")
plot(res, "profile")

ggplot2::autoplot(res, "clusters")

How S-MPDP works

Stage 1 builds a locally scaled mutual k-nearest-neighbour graph. It uses the normalised Laplacian and its leading eigenvectors to unfold the data. PCA then reduces this representation to one ordered signal.

Stage 2 fits candidate distributions to that signal. It selects a distribution by AIC, then uses dynamic programming to place the cluster boundaries.

The optimality statement applies to the one-dimensional signal and fitted model. It does not claim a global optimum for the original multivariate clustering problem.

The main setting is k_neighbors. Use smpdp_sensitivity() to assess a range of values. S-MPDP also checks graph connectivity and reports isolated points. These checks help identify neighbourhood settings that are too small.

Main tools

Task Function
Suggest the number of clusters suggest_k()
Measure bootstrap stability cluster_stability()
Evaluate selected clustering metrics cluster_metrics()
Compare selected methods, including optional MSC run_clustering_benchmarks()
Compare methods across datasets friedman_ranks()
Study tuning sensitivity smpdp_sensitivity()
Cluster one variable mpdp()
Use the broader method family clusta()
Compare candidate values of k clusta_elbow()

clusta() supports the "wcss", "projection", "estvar", "parametric", "spectral", "exact2d", "sweep", "sequence", and "graph" methods. WCSS results include a lower bound and an optimality gap when these quantities are available.

Data

The package includes seven real benchmark datasets: glass, breast_cancer, raisin, rice, ceramic, image_segmentation, and waveform. It also includes v_shape, cassini, and smpdp_toy, the worked example used in the S-MPDP paper.

Generators are provided for two moons, a V-shape, concentric circles, a smiley shape, three spirals, and a Cassini shape.

Shiny app

The bundled Shiny app provides an interactive interface to the package. It can load data, run S-MPDP, select comparison methods and metrics, display diagnostics, and export results. The app uses package functions, so its analyses can also be reproduced from the R console.

For uploaded data, the selected true-label column is excluded from the feature matrix automatically. This is important when labels are stored as numbers, because clustering on the label itself leaks the answer into the fit. Constant features are retained for clustering, but are omitted from standardised PCA diagnostics and reported in the interface.

shiny::runApp(system.file("app", package = "clusta"))

Vignettes

vignette("smpdp", package = "clusta")
vignette("clusta", package = "clusta")

Citation

citation("clusta")

Authors

  1. Karuna G. Reddy, karuna.reddy@auckland.ac.nz
  2. Gabiriele Bulivou, gabiriele.bulivou@usp.ac.fj
  3. M. G. M. Khan, mgm.khan@usp.ac.fj

Licence

GPL (>= 3).

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("clusta")

1.0-1 by Karuna G. Reddy, 15 hours ago


https://github.com/karunaredz/clusta


Report a bug at https://github.com/karunaredz/clusta/issues


Browse source code at https://github.com/cran/clusta


Authors: Karuna G. Reddy [aut, cre] , Gabiriele Bulivou [aut] , M. G. M. Khan [aut]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports stats, graphics, grDevices, utils, fitdistrplus

Suggests FitVerse, shiny, bslib, ggplot2, DT, cluster, clue, mclust, dbscan, mlbench, sClust, MASS, testthat, knitr, rmarkdown


See at CRAN