test_that("Cluster measures", {
keys = mlr_measures$keys("clust")
task = tsk("usarrests")
learner = lrn("clust.kmeans", centers = 2L)
p = learner$train(task)$predict(task)
for (key in keys) {
m = mlr_measures$get(key)
if (m$task_type == "clust") {
perf = m$score(prediction = p, task = task, learner = learner)
expect_number(perf, na.ok = FALSE, lower = m$range[1], upper = m$range[2])
}
}
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.