API References

Standard KDE, mean shift, and SCMS algorithms in a flat Euclidean space \(\mathbb{R}^d\)

sconce.EucSCMS.KDE(x, data, h=None, wt=None)[source]

The d-dim Euclidean KDE with the Gaussian kernel.

Parameters:
  • x ((m,d)-array) – The coordinates of m query points in the d-dim Euclidean space.

  • data ((n,d)-array) – The coordinates of n random sample points in the d-dimensional Euclidean space.

  • h (float) – The bandwidth parameter. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • wt ((n,)-array) – The weights of kernel density contributions for n random sample points. (Default: wt=None, that is, each data point has an equal weight “1/n”.)

Returns:

f_hat – The corresponding kernel density estimates at m query points.

Return type:

(m,)-array

sconce.EucSCMS.KDEGradLog(x, data, h=None, wt=None)[source]

The gradient of the logarithm of the d-dim Euclidean KDE with Gaussian kernel.

Parameters:
  • x ((m,d)-array) – The coordinates of m query points in the d-dim Euclidean space.

  • data ((n,d)-array) – The coordinates of n random sample points in the d-dimensional Euclidean space.

  • h (float) – The bandwidth parameter. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • wt ((n,)-array) – The weights of kernel density contributions for n random sample points. (Default: wt=None, that is, each data point has an equal weight “1/n”.)

Returns:

grad_log_hat – The corresponding gradients of the log-KDEs at m query points.

Return type:

(m,d)-array

sconce.EucSCMS.MS(mesh_0, data, h=None, eps=1e-07, max_iter=1000, wt=None)[source]

Mean Shift Algorithm with the Gaussian kernel.

Parameters:
  • mesh_0 (a (m,d)-array) – The coordinates of m initial points in the d-dim Euclidean space.

  • data (a (n,d)-array) – The coordinates of n data sample points in the d-dim Euclidean space.

  • h (float) – The bandwidth parameter. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • eps (float) – The precision parameter.

  • max_iter (int) – The maximum number of iterations for the SCMS algorithm on each initial point.

  • wt ((n,)-array) – The weights of kernel density contributions for n random sample points. (Default: wt=None, that is, each data point has an equal weight “1/n”.)

Returns:

MS_path – The entire iterative MS sequence for each initial point.

Return type:

(m,d,T)-array

sconce.EucSCMS.SCMS(mesh_0, data, d=1, h=None, eps=1e-07, max_iter=1000, wt=None, stop_cri='proj_grad')[source]

Subspace Constrained Mean Shift Algorithm with Gaussian kernel.

Parameters:
  • mesh_0 (a (m,D)-array) – The coordinates of m initial points in the D-dim Euclidean space.

  • data (a (n,D)-array) – The coordinates of n data sample points in the D-dim Euclidean space.

  • d (int) – The order of the density ridge.

  • h (float) – The bandwidth parameter. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • eps (float) – The precision parameter.

  • max_iter (int) – The maximum number of iterations for the SCMS algorithm on each initial point.

  • wt ((n,)-array) – The weights of kernel density contributions for n random sample points. (Default: wt=None, that is, each data point has an equal weight “1/n”.)

  • stop_cri (string ('proj_grad'/'pts_diff')) – The indicator of which stopping criteria that will be used to terminate the SCMS algorithm. (When stop_cri=’pts_diff’, the errors between two consecutive iteration points need to be smaller than ‘eps’ for terminating the algorithm. When stop_cri=’proj_grad’ or others, the projected/principal gradient of the current point need to be smaller than ‘eps’ for terminating the algorithm.)

Returns:

SCMS_path – The entire iterative SCMS sequence for each initial point.

Return type:

(m,D,T)-array

sconce.EucSCMS.SCMSLog(mesh_0, data, d=1, h=None, eps=1e-07, max_iter=1000, wt=None, stop_cri='proj_grad')[source]

Subspace Constrained Mean Shift algorithm with log density and Gaussian kernel.

Parameters:
  • mesh_0 (a (m,D)-array) – The coordinates of m initial points in the D-dim Euclidean space.

  • data (a (n,D)-array) – The coordinates of n data sample points in the D-dim Euclidean space.

  • d (int) – The order of the density ridge.

  • h (float) – The bandwidth parameter. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • eps (float) – The precision parameter.

  • max_iter (int) – The maximum number of iterations for the SCMS algorithm on each initial point.

  • wt ((n,)-array) – The weights of kernel density contributions for n random sample points. (Default: wt=None, that is, each data point has an equal weight “1/n”.)

  • stop_cri (string ('proj_grad'/'pts_diff')) – The indicator of which stopping criteria that will be used to terminate the SCMS algorithm. (When stop_cri=’pts_diff’, the errors between two consecutive iteration points need to be smaller than ‘eps’ for terminating the algorithm. When stop_cri=’proj_grad’ or others, the projected/principal gradient of the current point need to be smaller than ‘eps’ for terminating the algorithm.)

Returns:

SCMS_path – The entire iterative SCMS sequence for each initial point.

Return type:

(m,D,T)-array

Directional KDE, mean shift, and SCMS algorithms on the unit (hyper-)sphere \(\mathbb{S}^q\)

sconce.DirSCMS.DirKDE(x, data, h=None, wt=None)[source]

The q-dim directional KDE with the von Mises kernel.

Parameters:
  • x ((m,d)-array) – The Eulidean coordinates of m query points on a unit hypersphere, where d=q+1 is the Euclidean dimension of data

  • data ((n,d)-array) – The Euclidean coordinates of n directional random sample points in the d-dimensional Euclidean space.

  • h (float) – The bandwidth parameter. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • wt ((n,)-array) – The weights of kernel density contributions for n directional random sample points. (Default: wt=None, that is, each data point has an equal weight “1/n”.)

Returns:

f_hat – The corresponding directinal kernel density estimates at m query points.

Return type:

(m,)-array

Example

>>> import numpy as np
>>> from sconce.utils import CirSphSampling
>>> from sconce.DirSCMS import DirKDE
>>> cir_samp = CirSphSampling(2000, lat_c=50, lon_range=[-180,180],
                              sigma=0.1, pv_ax=np.array([1,0,0]))
>>> d_hat_dat = DirKDE(cir_samp, cir_samp, h=None)
>>> d_hat_dat
sconce.DirSCMS.DirKDEGradLog(x, data, h=None, wt=None)[source]

The (Riemannian) gradient of the logarithm of the q-dim directional KDE with the von Mises kernel.

Parameters:
  • x ((m,d)-array) – The Eulidean coordinates of m query points on a unit hypersphere, where d=q+1 is the Euclidean dimension of data

  • data ((n,d)-array) – The Euclidean coordinates of n directional random sample points in the d-dimensional Euclidean space.

  • h (float) – The bandwidth parameter. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • wt ((n,)-array) – The weights of kernel density contributions for n directional random sample points. (Default: wt=None, that is, each data point has an equal weight “1/n”.)

Returns:

Riem_grad_hat – The corresponding gradients of the log directional KDEs at m query points.

Return type:

(m,d)-array

sconce.DirSCMS.DirMS(y_0, data, h=None, eps=1e-07, max_iter=1000, wt=None, diff_method='all')[source]

Directional mean shift algorithm with the von-Mises Kernel.

Parameters:
  • y_0 ((N,d)-array) – The Euclidean coordinates of N directional initial points in d-dimensional Euclidean space.

  • data ((n,d)-array) – The Euclidean coordinates of n directional random sample points in d-dimensional Euclidean space.

  • h (float) – The bandwidth parameter. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • eps (float) – The precision parameter for stopping the mean shift iteration.

  • max_iter (int) – The maximum number of iterations for the mean shift iteration.

  • wt ((n,)-array) – The weights of kernel density contributions for n directional random sample points. (Default: wt=None, that is, each data point has the weight “1/n”.)

  • diff_method (str ('all'/'mean')) – The method of computing the differences between two consecutive sets of iteration points when they are compared with the precision parameter to stop the algorithm. (When diff_method=’all’, all the differences between two consecutive sets of iteration points need to be smaller than ‘eps’ for terminating the algorithm. When diff_method=’mean’, only the mean difference is compared with ‘eps’ and stop the algorithm.)

Returns:

MS_path – The whole iterative trajectory of every initial point yielded by the DMS algorithm.

Return type:

(N,d,T)-array

sconce.DirSCMS.DirSCMS(mesh_0, data, d=1, h=None, eps=1e-07, max_iter=1000, wt=None, stop_cri='proj_grad')[source]

Directional Subspace Constrained Mean Shift Algorithm with the von-Mises kernel.

Parameters:
  • mesh_0 (a (m,D)-array) – The Euclidean coordinates of m directional initial points in the D-dimensional Euclidean space.

  • data (a (n,D)-array) – The Euclidean coordinates of n directional data sample points in the D-dimensional Euclidean space.

  • d (int) – The order of the density ridge.

  • h (float) – The bandwidth parameter. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • eps (float) – The precision parameter.

  • max_iter (int) – The maximum number of iterations for the directional SCMS algorithm on each initial point.

  • wt ((n,)-array) – The weights of kernel density contributions for n directional random sample points. (Default: wt=None, that is, each data point has an equal weight “1/n”.)

  • stop_cri (string ('proj_grad'/'pts_diff')) – The indicator of which stopping criteria that will be used to terminate the SCMS algorithm. (When stop_cri=’pts_diff’, the errors between two consecutive iteration points need to be smaller than ‘eps’ for terminating the algorithm. When stop_cri=’proj_grad’ or others, the projected/principal (Riemannian) gradient of the current point need to be smaller than ‘eps’ for terminating the algorithm.)

Returns:

SCMS_path – The entire iterative DirSCMS sequence for each initial point.

Return type:

(m,D,T)-array

sconce.DirSCMS.DirSCMSLog(mesh_0, data, d=1, h=None, eps=1e-07, max_iter=1000, wt=None, stop_cri='proj_grad')[source]

Directional Subspace Constrained Mean Shift algorithm with log density and von-Mises kernel.

Parameters:
  • mesh_0 (a (m,D)-array) – The Euclidean coordinates of m directional initial points in the D-dimensional Euclidean space.

  • data (a (n,D)-array) – The Euclidean coordinates of n directional data sample points in the D-dimensional Euclidean space.

  • d (int) – The order of the density ridge.

  • h (float) – The bandwidth parameter. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • eps (float) – The precision parameter.

  • max_iter (int) – The maximum number of iterations for the directional SCMS algorithm on each initial point.

  • wt ((n,)-array) – The weights of kernel density contributions for n directional random sample points. (Default: wt=None, that is, each data point has an equal weight “1/n”.)

  • stop_cri (string ('proj_grad'/'pts_diff')) – The indicator of which stopping criteria that will be used to terminate the SCMS algorithm. (When stop_cri=’pts_diff’, the errors between two consecutive iteration points need to be smaller than ‘eps’ for terminating the algorithm. When stop_cri=’proj_grad’ or others, the projected/principal (Riemannian) gradient of the current point need to be smaller than ‘eps’ for terminating the algorithm.)

Returns:

SCMS_path – The entire iterative DirSCMS sequence for each initial point.

Return type:

(m,D,T)-array

Directional-linear KDE, mean shift, and SCMS algorithms on the directional-linear product space \(\mathbb{S}^q\times\mathbb{R}\)

sconce.DirLinSCMS.DirLinKDE(x, data, h=None, b=None, q=2, D=1)[source]

Directional-linear KDE with the von Mises and Gaussian kernels

Parameters:
  • x ((m, q+1+D)-array) – Eulidean coordinates of m directional-linear query points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • data ((n, q+1+D)-array) – Euclidean coordinates of n directional-linear random sample points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • h (float) – Bandwidth parameter for the directional component. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • b (float) – Bandwidth parameter for the linear component. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • q (int) – Intrinsic data dimension of directional components.

  • D (int) – Data dimension of linear components.

Returns:

f_hat – The corresponding directinal-linear density estimates at m query points.

Return type:

(m,)-array

sconce.DirLinSCMS.DirLinMS(mesh_0, data, h=None, b=None, q=2, D=1, eps=1e-07, max_iter=1000)[source]

Directional-linear Mean Shift Algorithm with the von Mises and Gaussian kernels (Simultaneous version)

Parameters:
  • mesh_0 ((m, q+1+D)-array) – Eulidean coordinates of m directional-linear query points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • data ((n, q+1+D)-array) – Euclidean coordinates of n directional-linear random sample points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • h (float) – Bandwidth parameter for the directional component. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • b (float) – Bandwidth parameter for the linear component. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • q (int) – Intrinsic data dimension of directional components.

  • D (int) – Data dimension of linear components.

  • eps (float) – The precision parameter.

  • max_iter (int) – The maximum number of iterations for the MS algorithm on each initial point.

Returns:

MS_path – The entire iterative MS sequence for each initial point.

Return type:

(m,q+1+D,T)-array

sconce.DirLinSCMS.DirLinMS_CA(mesh_0, data, h=None, b=None, q=2, D=1, eps=1e-07, max_iter=1000)[source]

Directional-Linear Mean Shift Algorithm with the von Mises and Gaussian kernels (Componentwise Ascending version)

Parameters:
  • mesh_0 ((m, q+1+D)-array) – Eulidean coordinates of m directional-linear query points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • data ((n, q+1+D)-array) – Euclidean coordinates of n directional-linear random sample points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • h (float) – Bandwidth parameter for the directional component. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • b (float) – Bandwidth parameter for the linear component. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • q (int) – Intrinsic data dimension of directional components.

  • D (int) – Data dimension of linear components.

  • eps (float) – The precision parameter.

  • max_iter (int) – The maximum number of iterations for the MS algorithm on each initial point.

Returns:

MS_path – The entire iterative MS sequence for each initial point.

Return type:

(m,q+1+D,T)-array

sconce.DirLinSCMS.DirLinSCMS(mesh_0, data, d=1, h=None, b=None, q=2, D=1, eps=1e-07, max_iter=1000)[source]

Directional-linear Subspace Constrained Mean Shift Algorithm with the von Mises and Gaussian kernels (Our proposed version, converging to DirLin ridges under the correct (Riemannian) gradient of DirLin KDE).

Parameters:
  • mesh_0 ((m, q+1+D)-array) – Eulidean coordinates of m directional-linear query points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • data ((n, q+1+D)-array) – Euclidean coordinates of n directional-linear random sample points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • d (int) – The order of the density ridge.

  • h (float) – Bandwidth parameter for the directional component. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • b (float) – Bandwidth parameter for the linear component. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • q (int) – Intrinsic data dimension of directional components.

  • D (int) – Data dimension of linear components.

  • eps (float) – The precision parameter.

  • max_iter (int) – The maximum number of iterations for the MS algorithm on each initial point.

Returns:

  • SCMS_path ((m,q+1+D,T)-array) – The entire iterative DirLinSCMS sequence for each initial point.

  • conv_sign ((m, )-array) – A array with 0 or 1 values indicating the convergence of each initial point.

sconce.DirLinSCMS.DirLinSCMSLog(mesh_0, data, d=1, h=None, b=None, q=2, D=1, eps=1e-07, max_iter=1000)[source]

Directional-linear Subspace Constrained Mean Shift Algorithm under the log-density with the von Mises and Gaussian kernels (Our proposed version, converging to DirLin ridges under the correct (Riemannian) gradient of DirLin KDE).

Parameters:
  • mesh_0 ((m, q+1+D)-array) – Eulidean coordinates of m directional-linear query points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • data ((n, q+1+D)-array) – Euclidean coordinates of n directional-linear random sample points, where (q+1) is the Euclidean dimension of the directional component (first (q+1) columns) and D is the dimension of the linear component (last D columns).

  • d (int) – The order of the density ridge.

  • h (float) – Bandwidth parameter for the directional component. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

  • b (float) – Bandwidth parameter for the linear component. (Default: h=None. Then the Silverman’s rule of thumb is applied. See Chen et al.(2016) for details.)

  • q (int) – Intrinsic data dimension of directional components.

  • D (int) – Data dimension of linear components.

  • eps (float) – The precision parameter.

  • max_iter (int) – The maximum number of iterations for the MS algorithm on each initial point.

Returns:

  • SCMS_path ((m,q+1+D,T)-array) – The entire iterative DirLinSCMS sequence for each initial point.

  • conv_sign ((m, )-array) – A array with 0 or 1 values indicating the convergence of each initial point.

Knot detection on a set of filamentary points

sconce.FilaAttr.DetectKnot(x, r_in, r_out, fila_map)[source]

Detecting if a point on the filament is a knot/intersection (Metric Graph Method).

Parameters:
  • x ((D,)-array) – The coordinate of the point of interest.

  • r_in (float) – The radius of the inner ball around the point of interest.

  • r_out (float) – The radius of the outer ball around the point of interest.

  • fila_map ((N,D)-array) – The coordinates of all the filament points.

Returns:

‘Knot’/’Non-Knot’ – The indicator of whether the point of interest is a knot/intersection on the input filament.

Return type:

str

Utilities for SCONCE-SCMS

sconce.utils.CirSphSampling(N, lat_c=60, lon_range=[-180, 180], sigma=0.01, pv_ax=numpy.array)[source]

Generating data points from a circle on the unit sphere with additive Gaussian noises to their Cartesian coordinates plus L2 normalizations.

Parameters:
  • N (int) – The number of randomly generated data points.

  • lat_c (float) – The latitude of the circle with respect to the pivotal axis. (range: 0-90)

  • lon_range (2-element list) – The longitude range that the circular structure covers. When “lon_range=[-180,180]”, the underlying structure is a full circle.

  • sigma (float) – The standard deviation of Gaussian noises.

  • pv_ax ((3,)-array) – The pivotal axis of the circle on the sphere from which the data points are generated (plus noises).

Returns:

pts_c_noise – The Cartesian coordinates of N simulated data points.

Return type:

(N,3)-array

sconce.utils.GaussMixture(N, mu=numpy.array, cov=numpy.diag.reshape, prob=[1.0])[source]

Generating data points from a Gaussian mixture model.

Parameters:
  • N (int) – The number of randomly generated data points.

  • mu ((m,d)-array) – The means of the Gaussian mixture model with m components.

  • cov ((d,d,m)-array) – The (d,d)-covariance matrices of the Gaussian mixture model with m components.

  • prob (list of floats) – The mixture probabilities.

Returns:

data_ps – The Cartesian coordinates of N simulated data points.

Return type:

(N,d)-array

sconce.utils.SmoothBootstrap_vMF(data, B=1000, h=None)[source]

Resampling a dataset using the smoothed bootstrap with the von Mises kernel.

Parameters:
  • data ((n,d)-array) – The Euclidean coordinates of n directional data points in the d-dimensional Euclidean space, where d=q+1.

  • B (int) – The number of bootstrapping times.

  • h (float) – The bandwidth parameter. (Default: h=None. Then a rule of thumb for directional KDEs with the von Mises kernel in Garcia-Portugues (2013) is applied.)

Returns:

data_Boot – The Euclidean coordinates of the smoothed bootstrap dataset.

Return type:

(n,d)-array

sconce.utils.cart2sph(x, y, z)[source]

Converting the Euclidean coordinate of a data point in R^3 to its Spherical coordinates.

Parameters:
  • x (floats) – Euclidean coordinate in R^3 of a data point.

  • y (floats) – Euclidean coordinate in R^3 of a data point.

  • z (floats) – Euclidean coordinate in R^3 of a data point.

Returns:

  • theta (float) – Longitude (ranging from -180 degree to 180 degree).

  • phi (float) – Latitude (ranging from -90 degree to 90 degree).

  • r (float) – Radial distance from the origin to the data point.

sconce.utils.sph2cart(theta, phi, r=1)[source]

Converting the Spherical coordinate of a data point to its Euclidean coordinate in R^3.

Parameters:
  • theta (float) – Longitude (ranging from -180 degree to 180 degree).

  • phi (float) – Latitude (ranging from -90 degree to 90 degree).

  • r (float) – Radial distance from the origin to the data point.

Returns:

x, y, z – Euclidean coordinate in R^3 of a data point.

Return type:

floats

sconce.utils.vMFDensity(x, mu=numpy.array, kappa=[1.0], prob=[1.0])[source]

The q-dimensional von-Mises Fisher (vMF) density function or its mixture.

Parameters:
  • x ((n,d)-array) – The Eulidean coordinates of n query points on a unit hypersphere, where d=q+1 is the Euclidean dimension of data.

  • mu ((m,d)-array) – The Euclidean coordinates of the m mean directions for a mixture of vMF densities.

  • kappa (list of floats) – The concentration parameters for a mixture of vMF densities.

  • prob (list of floats) – The mixture probabilities.

Returns:

mix_den – The corresponding density value on each query point.

Return type:

(n,)-array

sconce.utils.vMFGaussMixture(n, q=2, D=2, mu_vMF=numpy.array, kappa=[1.0], mu_N=numpy.array, cov=numpy.diag.reshape, prob=[1.0])[source]

Randomly sampling data points from a mixture of q-dimensional von-Mises Fisher and D-dimensional Gaussian distributions (directional-linear mixture model).

Parameters:
  • n (int) – The number of sampling random data points.

  • q (int) – Intrinsic data dimension of directional components.

  • D (int) – Data dimension of linear components.

  • mu_vMF (a (m,q+1)-array) – Euclidean coordinates of the m mean directions for the mixture of von-Mises Fisher densities.

  • kappa (list of floats) – The m concentration parameters for the mixture of von-Mises Fisher densities.

  • mu_N ((m,D)-array) – The means of the Gaussian mixture model with m components.

  • cov ((D,D,m)-array) – The (D,D)-covariance matrices of the Gaussian mixture model with m components.

  • prob (list of floats) – The m mixture probabilities.

Returns:

data_ps – Euclidean coordinates of the randomly sampled points from the vMF-Gaussian mixtures.

Return type:

(n, q+1+D)-array

sconce.utils.vMFMixtureSamp(n, mu=numpy.array, kappa=[1.0], prob=[1.0])[source]

Randomly sampling data points from a mixture of q-dimensional von-Mises Fisher (vMF) densities.

Parameters:
  • n (int) – The number of sampling random data points.

  • mu ((m,d)-array) – The Euclidean coordinates of the m mean directions for a mixture of vMF densities.

  • kappa (list of floats) – The concentration parameters for the mixture of von-Mises Fisher densities.

  • prob (list of floats) – The mixture probabilities.

Returns:

data_ps – The Euclidean coordinates of the randomly sampled points from the vMF mixture.

Return type:

(n,d)-array

sconce.utils.vMFRejectSamp(n, mu=numpy.array, kappa=1)[source]

Randomly sampling data points from a q-dimensional von-Mises Fisher (vMF) density via rejection sampling.

Parameters:
  • n (int) – The number of sampling random data points.

  • mu ((d, )-array) – The Euclidean coordinate of the mean directions of the q-dim vMF density, where d=q+1.

  • kappa (float) – The concentration parameter of the vMF density.

Returns:

data_ps – The Euclidean coordinates of the randomly sampled points from the vMF density.

Return type:

(n, d)-array

sconce.utils.vMFSamp(n, mu=numpy.array, kappa=1)[source]

Randomly sampling data points from a q-dimensional von-Mises Fisher (vMF) density with analytic approaches.

Parameters:
  • n (int) – The number of sampling random data points.

  • mu ((d, )-array) – The Euclidean coordinate of the mean directions of the q-dim vMF density, where d=q+1.

  • kappa (float) – The concentration parameter of the vMF density.

Returns:

data_ps – The Euclidean coordinates of the randomly sampled points from the vMF density.

Return type:

(n, d)-array