Title: | Clustering and Simulation of Spherical Cauchy and PKBD Models |
---|---|
Description: | Provides tools for estimation and clustering of spherical data, seamlessly integrated with the 'flexmix' package. Includes the necessary M-step implementations for both Poisson Kernel-Based Distribution (PKBD) and spherical Cauchy distribution. Additionally, the package provides random number generators for PKBD and spherical Cauchy distribution. Methods are based on Golzy M., Markatou M. (2020) <doi:10.1080/10618600.2020.1740713>, Kato S., McCullagh P. (2020) <doi:10.3150/20-bej1222> and Sablica L., Hornik K., Leydold J. (2023) <doi:10.1214/23-ejs2149>. |
Authors: | Lukas Sablica [aut, cre] , Kurt Hornik [aut] , Bettina Gruen [aut] , Josef Leydold [aut] |
Maintainer: | Lukas Sablica <[email protected]> |
License: | GPL-3 |
Version: | 0.0.1 |
Built: | 2024-12-17 06:55:25 UTC |
Source: | CRAN |
A dataset containing the abstracts of papers co-authored by Friedrich Leisch together with obtained metadata and embeddings generated using GMT and OpenAI embeddings models.
Abstracts
Abstracts
A data frame with 129 rows and 282 variables.
Calculates the density of the PKBD for given data points.
dpkbd(y, mu, rho, log = FALSE)
dpkbd(y, mu, rho, log = FALSE)
y |
A matrix or data frame where each row represents a data point on the unit hypersphere. |
mu |
A vector or matrix representing the mean direction parameter(s).
If a vector, it must be normalized (unit length) and is applied to all data points.
If a matrix, it must have the same number of rows as |
rho |
A scalar or a vector representing the concentration parameter.
If a vector, its length must match the number of rows in |
log |
Logical; if TRUE, the log-density is returned. Default is FALSE. |
This function calculates the density of the PKBD for each data point in y, given the parameters mu and rho.
A vector of density values (or log-density if log = TRUE) for each row in y.
y <- matrix(c(1, 0, 0, 0, 0, 1), ncol = 3, byrow = TRUE) mu <- c(1, 0, 0) rho <- 0.5 dpkbd(y, mu, rho)
y <- matrix(c(1, 0, 0, 0, 0, 1), ncol = 3, byrow = TRUE) mu <- c(1, 0, 0) rho <- 0.5 dpkbd(y, mu, rho)
Calculates the density of the spherical Cauchy distribution for given data points.
dspcauchy(y, mu, rho, log = FALSE)
dspcauchy(y, mu, rho, log = FALSE)
y |
A matrix or data frame where each row represents a data point on the unit hypersphere. |
mu |
A vector or matrix representing the mean direction parameter(s).
If a vector, it must be normalized (unit length) and is applied to all data points.
If a matrix, it must have the same number of rows as |
rho |
A scalar or a vector representing the concentration parameter.
If a vector, its length must match the number of rows in |
log |
Logical; if TRUE, the log-density is returned. Default is FALSE. |
This function calculates the density of the spherical Cauchy distribution for each data point in y, given the parameters mu and rho.
A vector of density values (or log-density if log = TRUE) for each row in y.
y <- matrix(c(1, 0, 0, 0, 0, 1), ncol = 3, byrow = TRUE) mu <- c(1, 0, 0) rho <- 0.5 dspcauchy(y, mu, rho)
y <- matrix(c(1, 0, 0, 0, 0, 1), ncol = 3, byrow = TRUE) mu <- c(1, 0, 0) rho <- 0.5 dspcauchy(y, mu, rho)
This model driver for flexmix implements model-based clustering of PKBD distributions.
FLXMCpkbd(formula = . ~ .)
FLXMCpkbd(formula = . ~ .)
formula |
A formula. |
Returns an object of class FLXMC
.
mix <- rbind(rpkbd(30, 0.95, c(1, 0, 0)), rpkbd(30, 0.9, c(-1, 0, 0))) m1 <- flexmix::flexmix(mix ~ 1, k = 2, model = FLXMCpkbd())
mix <- rbind(rpkbd(30, 0.95, c(1, 0, 0)), rpkbd(30, 0.9, c(-1, 0, 0))) m1 <- flexmix::flexmix(mix ~ 1, k = 2, model = FLXMCpkbd())
This model driver for flexmix implements model-based clustering of spherical Cauchy distributions.
FLXMCspcauchy(formula = . ~ .)
FLXMCspcauchy(formula = . ~ .)
formula |
A formula. |
Returns an object of class FLXMC
.
mix <- rbind(rpkbd(30, 0.95, c(1, 0, 0)), rpkbd(30, 0.9, c(-1, 0, 0))) m1 <- flexmix::flexmix(mix ~ 1, k = 2, model = FLXMCspcauchy())
mix <- rbind(rpkbd(30, 0.95, c(1, 0, 0)), rpkbd(30, 0.9, c(-1, 0, 0))) m1 <- flexmix::flexmix(mix ~ 1, k = 2, model = FLXMCspcauchy())
This model driver for flexmix implements model-based clustering of PKBD distributions using neural network in the M-step.
FLXMRpkbd( formula = . ~ ., EPOCHS = 100, LR = 0.1, max_iter = 200, adam_iter = 5, free_iter = adam_iter, line_search_fn = "strong_wolfe" )
FLXMRpkbd( formula = . ~ ., EPOCHS = 100, LR = 0.1, max_iter = 200, adam_iter = 5, free_iter = adam_iter, line_search_fn = "strong_wolfe" )
formula |
A formula. |
EPOCHS |
The number of epochs in the M-step estimation (default: 100). |
LR |
The learning rate used in the M-step estimation (default: 0.1). |
max_iter |
The maximum number of iterations of the LBFGS optimizer (default: 200). |
adam_iter |
The number of iteration for which the adam optimizer is used before the algorithm switches to L-BFGS (default: 5). |
free_iter |
The number of initial iterations for which the model in M-step is fully reseted (default: adam_iter). |
line_search_fn |
The method used for line search in LBFGS (default: "strong_wolfe"). |
Returns an object of class FLXMC
.
if(torch::torch_is_installed()){ mix <- rbind(rpkbd(30, 0.95, c(1, 0, 0)), rpkbd(30, 0.9, c(-1, 0, 0))) m1 <- flexmix::flexmix(mix ~ 1, k = 2, model = FLXMRpkbd()) }
if(torch::torch_is_installed()){ mix <- rbind(rpkbd(30, 0.95, c(1, 0, 0)), rpkbd(30, 0.9, c(-1, 0, 0))) m1 <- flexmix::flexmix(mix ~ 1, k = 2, model = FLXMRpkbd()) }
This model driver for flexmix implements model-based clustering of spherical Cauchy distributions using neural networks in the M-step.
FLXMRspcauchy( formula = . ~ ., EPOCHS = 100, LR = 0.1, max_iter = 200, adam_iter = 5, free_iter = adam_iter, line_search_fn = "strong_wolfe" )
FLXMRspcauchy( formula = . ~ ., EPOCHS = 100, LR = 0.1, max_iter = 200, adam_iter = 5, free_iter = adam_iter, line_search_fn = "strong_wolfe" )
formula |
A formula. |
EPOCHS |
EPOCHS The number of epochs in the M-step estimation (default: 100). |
LR |
The learning rate used in the M-steo estimation (default: 0.1). |
max_iter |
The maximum number of iterations of the LBFGS optimizer (default: 200). |
adam_iter |
The number of iteration for which the adam optimizer is used before the algorithm switches to L-BFGS (default: 5). |
free_iter |
The number of initial iterations for which the model in M-step is fully reseted (default: adam_iter). |
line_search_fn |
The method used for line search in LBFGS (default: "strong_wolfe"). |
Returns an object of class FLXMC
.
if(torch::torch_is_installed()){ mix <- rbind(rpkbd(30, 0.95, c(1, 0, 0)), rpkbd(30, 0.9, c(-1, 0, 0))) m1 <- flexmix::flexmix(mix ~ 1, k = 2, model = FLXMRspcauchy()) }
if(torch::torch_is_installed()){ mix <- rbind(rpkbd(30, 0.95, c(1, 0, 0)), rpkbd(30, 0.9, c(-1, 0, 0))) m1 <- flexmix::flexmix(mix ~ 1, k = 2, model = FLXMRspcauchy()) }
Generates a random sample from PKBD distributions.
rpkbd(n, rho, mu, method = "ACG")
rpkbd(n, rho, mu, method = "ACG")
n |
The number of random draws. |
rho |
A numeric giving the concentration parameter. |
mu |
A numeric vector giving the mean direction parameter. |
method |
A character indicating the method to use, |
A matrix with the generated values.
rpkbd(10, 0.95, c(1, 0, 0))
rpkbd(10, 0.95, c(1, 0, 0))
Generates a random sample from spherical Cauchy distributions.
rspcauchy(n, rho, mu)
rspcauchy(n, rho, mu)
n |
The number of random draws. |
rho |
A numeric value giving the rho parameter. |
mu |
A numeric vector giving the mu direction parameter. |
A matrix with the generated values.
rspcauchy(10, 0.95, c(1, 0, 0))
rspcauchy(10, 0.95, c(1, 0, 0))