PKBD#
- class QuadratiK.spherical_clustering.PKBD#
Class for estimating density and generating samples of Poisson-kernel based distribution (PKBD).
Methods
|
Function for estimating the density function of the PKB distribution. |
|
Function for generating a random sample from PKBD. |
- PKBD.dpkb(x, mu, rho, logdens=False)#
Function for estimating the density function of the PKB distribution.
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, mu, rho, method='rejvmf', random_state=None)#
Function for generating a random sample from PKBD. The number of observation generated is determined by n.
Parameters#
- nint
Sample size.
- mufloat
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 list with the matrix of generated observations, the number of tries and the number of acceptance.
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. “Efficient sampling from the PKBD distribution,” Electronic Journal of Statistics, 17(2), 2180-2209, (2023)
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]