Merged
Merged
Conversation
Kilian Fatras added 2 commits
June 15, 2018 18:53
Kilian Fatras added 2 commits
June 15, 2018 19:15
| return u | ||
|
|
||
|
|
||
| def transportation_matrix_entropic(a, b, M, reg, method, numItermax=10000, |
| for i in range(n_source): | ||
| r = M[i, :] - v | ||
| exp_v = np.exp(-r / reg) * b | ||
| u[i] = - reg * np.log(np.sum(exp_v)) |
| np.testing.assert_allclose( | ||
| zero, (G_asgd - G_sinkhorn).sum(1), atol=1e-03) # cf convergence asgd | ||
| np.testing.assert_allclose( | ||
| zero, (G_asgd - G_sinkhorn).sum(0), atol=1e-03) # cf convergence asgd |
| opt_u = c_transform_entropic(b, M, reg, opt_v) | ||
| pi = (np.exp((opt_u[:, None] + opt_v[None, :] - M[:, :]) / reg) * | ||
| a[:, None] * b[None, :]) | ||
| return pi |
|
|
||
| method = "ASGD" | ||
| asgd_pi, log = ot.stochastic.solve_semi_dual_entropic(a, b, M, reg, method, | ||
| numItermax, log) |
|
|
||
| import matplotlib.pylab as pl | ||
| import numpy as np | ||
| import ot |
| Compute the coordinate gradient update for regularized discrete | ||
| distributions for (i, :) | ||
|
|
||
| The function computes the gradient of the semi dual problem: |
| optimal transport max problem | ||
|
|
||
| The function solves the following optimization problem: | ||
| .. math:: |
| optimal transport max problem | ||
|
|
||
| The function solves the following optimization problem: | ||
| .. math:: |
| measures optimal transport max problem | ||
|
|
||
| The function solves the following optimization problem: | ||
| .. math:: |
| Computes the partial gradient of F_\W_varepsilon | ||
|
|
||
| Compute the partial gradient of the dual problem: | ||
| ..Math: |
| Computes the partial gradient of F_\W_varepsilon | ||
|
|
||
| Compute the partial gradient of the dual problem: | ||
| ..Math: |
| optimal transport dual problem | ||
|
|
||
| The function solves the following optimization problem: | ||
| .. math:: |
| optimal transport dual problem | ||
|
|
||
| The function solves the following optimization problem: | ||
| .. math:: |
Labels
None yet