| bqs_select | R Documentation |
Select solutions from a bqs object based on specified rank and type
of score.
bqs_select(
bqs_sol,
rank = 1,
type = "smooth",
rankby = NA,
boot_na_share = 0.25
)
bqs_sol |
An object of class |
rank |
An integer |
type |
A character string specifying the type of Quadratic Score.
Possible values are |
rankby |
A character string specifying the criteria used to rank
solutions in |
boot_na_share |
A numeric value between |
Even if the bqs_sol object is not pre-ranked, the user may specify a
ranking criterion to rank clustering solutions dynamically using the
rankby argument; this does not modify the original bqs_sol
object.
In these instances, the user can also specify boot_na_share as in
bqs_rank to exclude solutions based on the proportion of
unsuccessful bootstrap estimations. If rankby=NA, the bqs_sol
must be pre-ranked.
Selected solutions are always re-estimated on the full dataset before being
returned. Therefore, for stochastic clustering methods, repeated calls may
return different fitted solutions unless the user controls reproducibility,
e.g. via set.seed().
A named list of all clustering solutions achieving a type score of
rank rank when ranked according to rankby criterion, or
NULL if no such solution is available in the bqs_sol object.
List names correspond to methods' names in bqs_sol$methodset. Each
named entry contains the corresponding method re-estimated on
bqs_sol$data$data. If the full-data refit fails, the corresponding
entry is an object of class bqs_select_error containing the failure
status and message. If the requested rank exceeds the largest
available rank, the worst available rank is returned instead. If the
requested rank is within range but absent because of rank gaps,
NULL is returned.
bqs, bqs_rank
# Load data and set seed
set.seed(123)
data("banknote")
dat <- banknote[-1]
# set up kmeans, see help('mset_kmeans')
KM <- mset_kmeans(K = 2:5)
# set up Gaussian model-based clustering via gmix()
GMIX <- mset_gmix(K = 2:5, erc = c(1, 50, 100))
# combine tuned methods
mlist <- mbind(KM, GMIX)
# perform bootstrap
# set 'ncores' to the number of available physical cores
res <- bqs(dat, mlist, B = 20, type = "both", rankby = NA, ncores = 1,
oob = TRUE, savescores = TRUE, saveparams = FALSE)
# Methods are not ranked; this will raise an error
try(bqs_select(res, rank = 1))
# Rank method dynamically
ranked_res <- bqs_select(res, rank = 2, rankby = "lq",
boot_na_share = 0.25)
names(ranked_res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.