PKBD#
- class QuadratiK.spherical_clustering.PKBD#
Class for estimating density and generating samples of Poisson-kernel based distribution (PKBD). Details on PKBD can be found in User Guide.
Methods
|
Computes the density value for a given point x from the Poisson kernel-based distribution with mean direction vector mu and concentration parameter rho. |
|
Function for generating a random sample from PKBD. |
- PKBD.dpkb(x: ndarray | DataFrame, mu: ndarray, rho: float, logdens: bool = False) ndarray#
Computes the density value for a given point x from the Poisson kernel-based distribution with mean direction vector mu and concentration parameter rho.
Parameters#
- xnumpy.ndarray, pandas.DataFrame
A matrix with a number of columns >= 2.
- mufloat
Location parameter with the same length as the rows of x. Normalized to length one.
- rhofloat
Concentration parameter. \(\rho \in (0,1]\).
- logdensbool, optional
If True, densities d are given as \(\log(d)\). Defaults to False.
Returns#
- densitynumpy.ndarray
An array with the evaluated density values.
- PKBD.rpkb(n: int, mu: ndarray | list[float], rho: float, method: str = 'rejvmf', random_state: int | None = None) ndarray#
Function for generating a random sample from PKBD. The number of observation generated is determined by n.
Parameters#
- nint
Sample size.
- munp.ndarray, list
Location parameter with the same length as the quantiles.
- rhofloat
Concentration parameter. \(\rho \in (0,1]\).
- methodstr, optional
String that indicates the method used for sampling observations. The available methods are :
- ‘rejvmf’: acceptance-rejection algorithm using von Mises-Fisher envelops.
(Algorithm in Table 2 of Golzy and Markatou 2020);
- ‘rejacg’: using angular central Gaussian envelops.
(Algorithm in Table 1 of Sablica et al. 2023);
Defaults to ‘rejvmf’.
- random_stateint, None, optional.
Seed for random number generation. Defaults to None.
Returns#
- samplesnumpy.ndarray
Generated observations from a poisson kernel-based density. This function returns a matrix of generated observations.
References#
Golzy M. & Markatou M. (2020) Poisson Kernel-Based Clustering on the Sphere: Convergence Properties, Identifiability, and a Method of Sampling, Journal of Computational and Graphical Statistics, 29:4, 758-770, DOI: 10.1080/10618600.2020.1740713.
Sablica, L., Hornik, K., & Leydold, J. (2023). Efficient sampling from the PKBD distribution. Electronic Journal of Statistics, 17(2), 2180-2209.
Examples#
from QuadratiK.spherical_clustering import PKBD pkbd_data = PKBD().rpkb(10,[0.5,0],0.5, "rejvmf", random_state= 42) dens_val = PKBD().dpkb(pkbd_data, [0.5,0.5],0.5) print(dens_val)
[0.46827108 0.05479605 0.21163936 0.06195099 0.39567698 0.40473724 0.26561508 0.36791766 0.09324676 0.46847274]