ott.geometry.low_rank.LRKGeometry#
- class ott.geometry.low_rank.LRKGeometry(k1, k2, epsilon=None, **kwargs)[source]#
Low-rank kernel geometry.
Note
This constructor is not meant to be called by the user, please use the
from_pointcloud()method instead.- Parameters:
Methods
apply_cost(arr[, axis, fn, is_linear])Apply
cost_matrixto array (vector or matrix).apply_kernel(vec[, eps, axis])Apply
kernel_matrixon positive scaling vector.apply_lse_kernel(f, g, eps[, vec, axis])Apply
kernel_matrixin log domain.apply_square_cost(arr[, axis])Apply elementwise-square of cost matrix to array (vector or matrix).
apply_transport_from_potentials(f, g, vec[, ...])Apply transport matrix computed from potentials to a (batched) vec.
apply_transport_from_scalings(u, v, vec[, axis])Apply transport matrix computed from scalings to a (batched) vec.
copy_epsilon(other)Copy the epsilon parameters from another geometry.
from_pointcloud(x, y, *, kernel[, rank, ...])Low-rank kernel approximation [Scetbon and Cuturi, 2020].
marginal_from_potentials(f, g[, axis])Output marginal of transportation matrix from potentials.
marginal_from_scalings(u, v[, axis])Output marginal of transportation matrix from scalings.
potential_from_scaling(scaling)Compute dual potential vector from scaling vector.
prepare_divergences(*args[, static_b])Instantiate 2 (or 3) geometries to compute a Sinkhorn divergence.
scaling_from_potential(potential)Compute scaling vector from dual potential.
set_scale_cost(scale_cost)Modify how to rescale of the
cost_matrix.subset([row_ixs, col_ixs])Subset rows or columns of a geometry.
to_LRCGeometry([rank, tol, rng, scale])Factorize the cost matrix using either SVD (full) or [Indyk et al., 2019].
Not implemented.
transport_from_scalings(u, v)Output transport matrix from pair of scalings.
update_potential(f, g, log_marginal[, ...])Carry out one Sinkhorn update for potentials, i.e. in log space.
update_scaling(scaling, marginal[, ...])Carry out one Sinkhorn update for scalings, using kernel directly.
Attributes
Check quickly if casting geometry as LRC makes sense.
Cost matrix, recomputed from kernel if only kernel was specified.
Output rank of cost matrix, if any was provided.
Diagonal of the cost matrix.
The data type.
Epsilon regularization value.
Epsilon scheduler.
Compute and return inverse of scaling factor for cost matrix.
Whether geometry cost/kernel should be recomputed on the fly.
Whether geometry cost/kernel is a square matrix.
Whether cost is computed by taking squared Euclidean distance.
Whether geometry cost/kernel is a symmetric matrix.
Kernel matrix.
Mean of the
cost_matrix.Median of the
cost_matrix.Shape of the geometry.
Standard deviation of all values stored in
cost_matrix.