dbscan_tidiers {dbscan} | R Documentation |
Turn an dbscan clustering object into a tidy tibble
Description
Provides tidy(), augment(), and
glance() verbs for clusterings created with algorithms
in package dbscan
to work with tidymodels.
Usage
tidy(x, ...)
## S3 method for class 'dbscan'
tidy(x, ...)
## S3 method for class 'hdbscan'
tidy(x, ...)
## S3 method for class 'general_clustering'
tidy(x, ...)
augment(x, ...)
## S3 method for class 'dbscan'
augment(x, data = NULL, newdata = NULL, ...)
## S3 method for class 'hdbscan'
augment(x, data = NULL, newdata = NULL, ...)
## S3 method for class 'general_clustering'
augment(x, data = NULL, newdata = NULL, ...)
glance(x, ...)
## S3 method for class 'dbscan'
glance(x, ...)
## S3 method for class 'hdbscan'
glance(x, ...)
## S3 method for class 'general_clustering'
glance(x, ...)
Arguments
x |
An |
... |
further arguments are ignored without a warning. |
data |
The data used to create the clustering. |
newdata |
New data to predict cluster labels for. |
See Also
generics::tidy()
, generics::augment()
,
generics::glance()
, dbscan()
Examples
data(iris)
x <- scale(iris[, 1:4])
## dbscan
db <- dbscan(x, eps = .9, minPts = 5)
db
# summarize model fit with tidiers
tidy(db)
glance(db)
# augment for this model needs the original data
augment(db, x)
# to augment new data, the original data is also needed
augment(db, x, newdata = x[1:5, ])
## hdbscan
hdb <- hdbscan(x, minPts = 5)
# summarize model fit with tidiers
tidy(hdb)
glance(hdb)
# augment for this model needs the original data
augment(hdb, x)
# to augment new data, the original data is also needed
augment(hdb, x, newdata = x[1:5, ])
## Jarvis-Patrick clustering
cl <- jpclust(x, k = 20, kt = 15)
# summarize model fit with tidiers
tidy(cl)
glance(cl)
# augment for this model needs the original data
augment(cl, x)
## Shared Nearest Neighbor clustering
cl <- sNNclust(x, k = 20, eps = 0.8, minPts = 15)
# summarize model fit with tidiers
tidy(cl)
glance(cl)
# augment for this model needs the original data
augment(cl, x)
[Package dbscan version 1.2-0 Index]