Compute the matrix of the squared Bures distances between the components of
two Gaussian Mixture Models (GMMs). Used to compute the GMM Optimal
Transport distance [69].
Parameters:
m_s (array-like, shape (k_s, d)) – Mean vectors of the source GMM.
m_t (array-like, shape (k_t, d)) – Mean vectors of the target GMM.
C_s (array-like, shape (k_s, d, d)) – Covariance matrices of the source GMM.
C_t (array-like, shape (k_t, d, d)) – Covariance matrices of the target GMM.
Returns:
dist – Matrix of squared Bures distances between the components of the source
and target GMMs.
Solves the Gaussian Mixture Model OT barycenter problem (defined in [69])
using the fixed point algorithm (proposed in [77]). The
weights of the barycenter are not optimized, and stay the same as the input
w_list or are initialized to uniform.
The algorithm uses barycentric projections of GMM-OT plans, and these can be
computed either through Bures Barycenters (slow but accurate,
barycentric_proj_method=’bures’) or by convex combination (fast,
barycentric_proj_method=’euclidean’, default).
This is a special case of the generic free-support barycenter solver
ot.lp.free_support_barycenter_generic_costs.
Parameters:
means_list (list of array-like) – List of K (m_k, d) GMM means.
covs_list (list of array-like) – List of K (m_k, d, d) GMM covariances.
w_list (list of array-like) – List of K (m_k) arrays of weights.
Apply Gaussian Mixture Model (GMM) optimal transport (OT) mapping to input
data. The ‘barycentric’ mapping corresponds to the barycentric projection
of the GMM-OT plan, and is called T_bary in [69]. The ‘random’ mapping takes
for each input point a random pair (i,j) of components of the GMMs and
applied the Gaussian map, it is called T_rand in [69].
Parameters:
x (array-like, shape (n_samples, d)) – Input data points.
m_s (array-like, shape (k_s, d)) – Mean vectors of the source GMM components.
m_t (array-like, shape (k_t, d)) – Mean vectors of the target GMM components.
C_s (array-like, shape (k_s, d, d)) – Covariance matrices of the source GMM components.
C_t (array-like, shape (k_t, d, d)) – Covariance matrices of the target GMM components.
w_s (array-like, shape (k_s,)) – Weights of the source GMM components.
w_t (array-like, shape (k_t,)) – Weights of the target GMM components.
plan (array-like, shape (k_s, k_t), optional) – Optimal transport plan between the source and target GMM components.
If not provided, it will be computed internally.
method ({'bary', 'rand'}, optional) – Method for applying the GMM OT mapping. ‘bary’ uses barycentric mapping,
while ‘rand’ uses random sampling. Default is ‘bary’.
seed (int, optional) – Seed for the random number generator. Only used when method=’rand’.
Returns:
out – Output data points after applying the GMM OT mapping.
Compute the Gaussian Mixture Model (GMM) Optimal Transport distance between
two GMMs introduced in [69].
Parameters:
m_s (array-like, shape (k_s, d)) – Mean vectors of the source GMM.
m_t (array-like, shape (k_t, d)) – Mean vectors of the target GMM.
C_s (array-like, shape (k_s, d, d)) – Covariance matrices of the source GMM.
C_t (array-like, shape (k_t, d, d)) – Covariance matrices of the target GMM.
w_s (array-like, shape (k_s,)) – Weights of the source GMM components.
w_t (array-like, shape (k_t,)) – Weights of the target GMM components.
log (bool, optional (default=False)) – If True, returns a dictionary containing the cost and dual variables.
Otherwise returns only the GMM optimal transportation cost.
Returns:
loss (float or array-like) – The GMM-OT loss.
log (dict, optional) – If input log is true, a dictionary containing the
cost and dual variables and exit status
Compute the Gaussian Mixture Model (GMM) Optimal Transport plan between
two GMMs introduced in [69].
Parameters:
m_s (array-like, shape (k_s, d)) – Mean vectors of the source GMM.
m_t (array-like, shape (k_t, d)) – Mean vectors of the target GMM.
C_s (array-like, shape (k_s, d, d)) – Covariance matrices of the source GMM.
C_t (array-like, shape (k_t, d, d)) – Covariance matrices of the target GMM.
w_s (array-like, shape (k_s,)) – Weights of the source GMM components.
w_t (array-like, shape (k_t,)) – Weights of the target GMM components.
log (bool, optional (default=False)) – If True, returns a dictionary containing the cost and dual variables.
Otherwise returns only the GMM optimal transportation matrix.
Returns:
plan (array-like, shape (k_s, k_t)) – The GMM-OT plan.
log (dict, optional) – If input log is true, a dictionary containing the
cost and dual variables and exit status
References
ot.gmm.gmm_ot_plan_density(x, y, m_s, m_t, C_s, C_t, w_s, w_t, plan=None, atol=0.01)[source]
Compute the density of the Gaussian Mixture Model - Optimal Transport
coupling between GMMS at given points, as introduced in [69].
Given two arrays of points x and y, the function computes the density at
each point (x[i], y[i]) of the product space.
Parameters:
x (array-like, shape (n, d)) – Entry points in source space for density computation.
y (array-like, shape (m, d)) – Entry points in target space for density computation.
m_s (array-like, shape (k_s, d)) – The means of the source GMM components.
m_t (array-like, shape (k_t, d)) – The means of the target GMM components.
C_s (array-like, shape (k_s, d, d)) – The covariance matrices of the source GMM components.
C_t (array-like, shape (k_t, d, d)) – The covariance matrices of the target GMM components.
w_s (array-like, shape (k_s,)) – The weights of the source GMM components.
w_t (array-like, shape (k_t,)) – The weights of the target GMM components.
plan (array-like, shape (k_s, k_t), optional) – The optimal transport plan between the source and target GMMs.
If not provided, it will be computed using gmm_ot_plan.
atol (float, optional) – The absolute tolerance used to determine the support of the GMM-OT
coupling.
Returns:
density – The density of the GMM-OT coupling between the two GMMs.
Compute the matrix of the squared Bures distances between the components of
two Gaussian Mixture Models (GMMs). Used to compute the GMM Optimal
Transport distance [69].
Parameters:
m_s (array-like, shape (k_s, d)) – Mean vectors of the source GMM.
m_t (array-like, shape (k_t, d)) – Mean vectors of the target GMM.
C_s (array-like, shape (k_s, d, d)) – Covariance matrices of the source GMM.
C_t (array-like, shape (k_t, d, d)) – Covariance matrices of the target GMM.
Returns:
dist – Matrix of squared Bures distances between the components of the source
and target GMMs.
Solves the Gaussian Mixture Model OT barycenter problem (defined in [69])
using the fixed point algorithm (proposed in [77]). The
weights of the barycenter are not optimized, and stay the same as the input
w_list or are initialized to uniform.
The algorithm uses barycentric projections of GMM-OT plans, and these can be
computed either through Bures Barycenters (slow but accurate,
barycentric_proj_method=’bures’) or by convex combination (fast,
barycentric_proj_method=’euclidean’, default).
This is a special case of the generic free-support barycenter solver
ot.lp.free_support_barycenter_generic_costs.
Parameters:
means_list (list of array-like) – List of K (m_k, d) GMM means.
covs_list (list of array-like) – List of K (m_k, d, d) GMM covariances.
w_list (list of array-like) – List of K (m_k) arrays of weights.
Apply Gaussian Mixture Model (GMM) optimal transport (OT) mapping to input
data. The ‘barycentric’ mapping corresponds to the barycentric projection
of the GMM-OT plan, and is called T_bary in [69]. The ‘random’ mapping takes
for each input point a random pair (i,j) of components of the GMMs and
applied the Gaussian map, it is called T_rand in [69].
Parameters:
x (array-like, shape (n_samples, d)) – Input data points.
m_s (array-like, shape (k_s, d)) – Mean vectors of the source GMM components.
m_t (array-like, shape (k_t, d)) – Mean vectors of the target GMM components.
C_s (array-like, shape (k_s, d, d)) – Covariance matrices of the source GMM components.
C_t (array-like, shape (k_t, d, d)) – Covariance matrices of the target GMM components.
w_s (array-like, shape (k_s,)) – Weights of the source GMM components.
w_t (array-like, shape (k_t,)) – Weights of the target GMM components.
plan (array-like, shape (k_s, k_t), optional) – Optimal transport plan between the source and target GMM components.
If not provided, it will be computed internally.
method ({'bary', 'rand'}, optional) – Method for applying the GMM OT mapping. ‘bary’ uses barycentric mapping,
while ‘rand’ uses random sampling. Default is ‘bary’.
seed (int, optional) – Seed for the random number generator. Only used when method=’rand’.
Returns:
out – Output data points after applying the GMM OT mapping.
Compute the Gaussian Mixture Model (GMM) Optimal Transport distance between
two GMMs introduced in [69].
Parameters:
m_s (array-like, shape (k_s, d)) – Mean vectors of the source GMM.
m_t (array-like, shape (k_t, d)) – Mean vectors of the target GMM.
C_s (array-like, shape (k_s, d, d)) – Covariance matrices of the source GMM.
C_t (array-like, shape (k_t, d, d)) – Covariance matrices of the target GMM.
w_s (array-like, shape (k_s,)) – Weights of the source GMM components.
w_t (array-like, shape (k_t,)) – Weights of the target GMM components.
log (bool, optional (default=False)) – If True, returns a dictionary containing the cost and dual variables.
Otherwise returns only the GMM optimal transportation cost.
Returns:
loss (float or array-like) – The GMM-OT loss.
log (dict, optional) – If input log is true, a dictionary containing the
cost and dual variables and exit status
Compute the Gaussian Mixture Model (GMM) Optimal Transport plan between
two GMMs introduced in [69].
Parameters:
m_s (array-like, shape (k_s, d)) – Mean vectors of the source GMM.
m_t (array-like, shape (k_t, d)) – Mean vectors of the target GMM.
C_s (array-like, shape (k_s, d, d)) – Covariance matrices of the source GMM.
C_t (array-like, shape (k_t, d, d)) – Covariance matrices of the target GMM.
w_s (array-like, shape (k_s,)) – Weights of the source GMM components.
w_t (array-like, shape (k_t,)) – Weights of the target GMM components.
log (bool, optional (default=False)) – If True, returns a dictionary containing the cost and dual variables.
Otherwise returns only the GMM optimal transportation matrix.
Returns:
plan (array-like, shape (k_s, k_t)) – The GMM-OT plan.
log (dict, optional) – If input log is true, a dictionary containing the
cost and dual variables and exit status
References
ot.gmm.gmm_ot_plan_density(x, y, m_s, m_t, C_s, C_t, w_s, w_t, plan=None, atol=0.01)[source]
Compute the density of the Gaussian Mixture Model - Optimal Transport
coupling between GMMS at given points, as introduced in [69].
Given two arrays of points x and y, the function computes the density at
each point (x[i], y[i]) of the product space.
Parameters:
x (array-like, shape (n, d)) – Entry points in source space for density computation.
y (array-like, shape (m, d)) – Entry points in target space for density computation.
m_s (array-like, shape (k_s, d)) – The means of the source GMM components.
m_t (array-like, shape (k_t, d)) – The means of the target GMM components.
C_s (array-like, shape (k_s, d, d)) – The covariance matrices of the source GMM components.
C_t (array-like, shape (k_t, d, d)) – The covariance matrices of the target GMM components.
w_s (array-like, shape (k_s,)) – The weights of the source GMM components.
w_t (array-like, shape (k_t,)) – The weights of the target GMM components.
plan (array-like, shape (k_s, k_t), optional) – The optimal transport plan between the source and target GMMs.
If not provided, it will be computed using gmm_ot_plan.
atol (float, optional) – The absolute tolerance used to determine the support of the GMM-OT
coupling.
Returns:
density – The density of the GMM-OT coupling between the two GMMs.