Last active
October 13, 2020 15:24
-
-
Save m-Py/597ccea1651685a79dc6673af48556de to your computer and use it in GitHub Desktop.
Test out the most recent version (v0.5.4) of anticlust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 1. Load - and, if required, install - package `anticlust` | |
if (!requireNamespace("remotes")) { | |
install.packages("remotes") | |
} | |
remotes::install_github("m-Py/anticlust") | |
library(anticlust) | |
# Try out anticlustering - if there are no errors, everything is fine | |
# Optimize the cluster editing (diversity) criterion | |
anticlusters <- anticlustering( | |
schaper2019[, 3:6], | |
K = 3, | |
categories = schaper2019$room | |
) | |
anticlusters | |
# Use multiple starts of the algorithm to improve the objective and | |
# optimize the k-means criterion ("variance") | |
anticlusters <- anticlustering( | |
schaper2019[, 3:6], | |
objective = "variance", | |
K = 3, | |
categories = schaper2019$room, | |
method = "local-maximum", | |
repetitions = 2 | |
) | |
anticlusters | |
# Optimize dispersion | |
anticlusters <- anticlustering( | |
dist(rnorm(100)), | |
objective = "dispersion", | |
K = 10 | |
) | |
anticlusters |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment