Skip to content

Commit a9ead60

Browse files
committed
docs(readme): show some actually output
1 parent 51db2c3 commit a9ead60

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Suggests:
3838
LPCM,
3939
mclust,
4040
mlbench,
41+
mlr3viz,
4142
RWeka,
4243
stream,
4344
testthat (>= 3.0.0)

R/MeasureClustInternal.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#' @include MeasureClust.R
33
MeasureClustFPC = R6Class("MeasureClustFPC",
44
inherit = MeasureClust,
5+
cloneable = FALSE,
56
public = list(
67
crit = NULL,
78
initialize = function(name, label) {
@@ -29,6 +30,7 @@ MeasureClustFPC = R6Class("MeasureClustFPC",
2930

3031
MeasureClustSil = R6Class("MeasureClustSil",
3132
inherit = MeasureClust,
33+
cloneable = FALSE,
3234
public = list(
3335
crit = NULL,
3436
initialize = function(name, label) {

README.Rmd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,18 @@ knitr::kable(msr_clust, format = "markdown", col.names = tools::toTitleCase(name
9494

9595
## Example
9696

97-
```{r, eval = FALSE}
97+
```{r}
9898
library(mlr3)
99+
library(mlr3viz)
99100
library(mlr3cluster)
100101
101102
task = tsk("usarrests")
103+
task
104+
102105
learner = lrn("clust.kmeans")
103-
learner$train(task)
104-
prediction = learner$predict(task = task)
106+
prediction = learner$train(task)$predict(task)
107+
measures = msrs(c("clust.wss", "clust.silhouette"))
108+
prediction$score(measures, task)
105109
```
106110

107111
## More Resources

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,25 @@ create great visualizations with just one line of code!
9494

9595
``` r
9696
library(mlr3)
97+
library(mlr3viz)
9798
library(mlr3cluster)
9899

99100
task = tsk("usarrests")
101+
task
102+
#>
103+
#> ── <TaskClust> (50x4): US Arrests ──────────────────────────────────────────────
104+
#> • Target:
105+
#> • Properties: -
106+
#> • Features (4):
107+
#> • int (2): Assault, UrbanPop
108+
#> • dbl (2): Murder, Rape
109+
100110
learner = lrn("clust.kmeans")
101-
learner$train(task)
102-
prediction = learner$predict(task = task)
111+
prediction = learner$train(task)$predict(task)
112+
measures = msrs(c("clust.wss", "clust.silhouette"))
113+
prediction$score(measures, task)
114+
#> clust.wss clust.silhouette
115+
#> 9.639903e+04 5.926554e-01
103116
```
104117

105118
## More Resources

man/TaskClust.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
113 KB
Loading

0 commit comments

Comments
 (0)