File: methods_dbscan.R

package info (click to toggle)
r-cran-parameters 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,852 kB
  • sloc: sh: 16; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 664 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#' @export
model_parameters.dbscan <- function(model, data = NULL, clusters = NULL, ...) {
  if (is.null(data)) {
    insight::format_error("This function requires the data used to compute the clustering to be provided via `data` as it is not accessible from the clustering object itself.")
  }

  if (is.null(clusters)) {
    clusters <- model$cluster
  }

  params <- .cluster_centers_params(data, clusters, ...)

  attr(params, "model") <- model
  attr(params, "type") <- "dbscan"
  attr(params, "title") <- ifelse(inherits(model, "hdbscan"), "HDBSCAN", "DBSCAN")

  params
}

#' @export
model_parameters.hdbscan <- model_parameters.dbscan