knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(data.table) library(mlr3cluster) library(mlr3misc) lrn_clust = as.data.table(mlr3::mlr_learners)[task_type == "clust", .(key, label, packages)] msr_clust = as.data.table(mlr3::mlr_measures)[task_type == "clust", .(key, label, packages)]
Package website: release \| dev
Cluster analysis for mlr3.
mlr3cluster is an extension package for cluster analysis within the mlr3 ecosystem. It is a successor of clustering capabilities of mlr2.
Install the last release from CRAN:
install.packages("mlr3cluster")
Install the development version from GitHub:
# install.packages("pak") pak::pak("mlr-org/mlr3cluster")
The current version of mlr3cluster contains:
r nrow(lrn_clust)
clustering learners that represent a wide variety of clusterers: partitional, hierarchical, fuzzy, etc.r nrow(msr_clust)
performance measuresAlso, the package is integrated with mlr3viz which enables you to create great visualizations with just one line of code!
cran_pkg = function(pkgs) { pkgs = fifelse( pkgs %chin% c("stats", "graphics", "datasets"), pkgs, sprintf("[%1$s](https://cran.r-project.org/package=%1$s)", pkgs) ) toString(pkgs) } lrn_clust[, packages := map(packages, function(x) setdiff(x, c("mlr3", "mlr3cluster")))] lrn_clust[, `:=`( key = sprintf("[%1$s](https://mlr3cluster.mlr-org.com/reference/mlr_learners_%1$s)", key), packages = map_chr(packages, cran_pkg) )] knitr::kable(lrn_clust, format = "markdown", col.names = tools::toTitleCase(names(lrn_clust)))
msr_clust[, packages := map(packages, function(x) setdiff(x, c("mlr3", "mlr3cluster")))] msr_clust[, `:=`( key = sprintf("[%1$s](https://mlr3cluster.mlr-org.com/reference/mlr_measures_%1$s)", key), packages = map_chr(packages, cran_pkg) )] knitr::kable(msr_clust, format = "markdown", col.names = tools::toTitleCase(names(msr_clust)))
library(mlr3) library(mlr3cluster) task = tsk("usarrests") learner = lrn("clust.kmeans") learner$train(task) prediction = learner$predict(task = task)
Check out the blogpost for a more detailed introduction to the package. Also, mlr3book has a section on clustering.
If you have any questions, feedback or ideas, feel free to open an issue here.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.