Implements methods for clustering mixed-type data,
specifically combinations of continuous and nominal data. Special attention
is paid to the often-overlooked problem of equitably balancing the
contribution of the continuous and categorical variables. This package
implements KAMILA clustering, a novel method for clustering
mixed-type data in the spirit of k-means clustering. It does not require
dummy coding of variables, and is efficient enough to scale to rather large
data sets. Also implemented is Modha-Spangler clustering, which uses a
brute-force strategy to maximize the cluster separation simultaneously in the
continuous and categorical variables. For more information, see Foss, Markatou,
Ray, & Heching (2016)
kamila implements methods for clustering mixed-type data (continuous and nominal categorical variables), specifically KAMILA (KA-means for MIXed LArge datasets) and Modha-Spangler clustering. Special attention is paid to the problem of equitably balancing the contribution of continuous and categorical variables without requiring artificial dummy coding.
install.packages("kamila")
# install.packages("remotes")
remotes::install_github("ahfoss/kamila")
library(kamila)
# Generate synthetic mixed-type data (continuous + categorical)
set.seed(123)
dat <- genMixedData(
sampSize = 200,
nCon = 3,
nCat = 2,
nClust = 3,
nIndepConCat = 0
)
# Run KAMILA clustering (e.g., K = 3 clusters with 5 random initializations)
kamRes <- kamila(
conVar = dat$conVars,
catFactor = dat$catVars,
numClust = 3,
numInit = 5
)
# Inspect cluster assignments
table(True = dat$trueID, Predicted = kamRes$finalMemb)
For an in-depth discussion of the challenges involved in clustering mixed-type data, please see:
For release notes and version history, see NEWS.md.
Explore and benchmark KAMILA against competing mixed-type clustering algorithms (FlexMix, PAM + Gower's distance, k-prototypes, VarSelLCM) interactively:
No installation required: Runs 100% client-side in your web browser via WebR & Shinylive.
To run the dashboard locally:
shiny::runGitHub(
repo = "kamila",
username = "ahfoss",
ref = "master",
subdir = "inst/shiny/horserace"
)
For contributors proposing algorithmic speedups, kamila includes a statistical superiority testing framework. For details on how to run local benchmarks or trigger CI via PR labels, see SUPERIORITY_TESTING.md.