r""" This function computes the next gamma value if a variable is removed at the next iteration of the regularization path. We look for the largest value of the regularization parameter such that an element of the current solution vanishes .. math:: \max_{j \in A} \frac{\ph
(phi, delta, current_gamma)
| 355 | |
| 356 | |
| 357 | def compute_next_removal(phi, delta, current_gamma): |
| 358 | r""" This function computes the next gamma value if a variable |
| 359 | is removed at the next iteration of the regularization path. |
| 360 | |
| 361 | We look for the largest value of the regularization parameter such that |
| 362 | an element of the current solution vanishes |
| 363 | |
| 364 | .. math:: |
| 365 | \max_{j \in A} \frac{\phi_j}{\delta_j} |
| 366 | |
| 367 | where : |
| 368 | |
| 369 | - A is the current active set |
| 370 | - :math:`\phi_j` is the :math:`j` th element of the intercept of the \ |
| 371 | current solution |
| 372 | - :math:`\delta_j` is the :math:`j` th element of the slope of the \ |
| 373 | current solution |
| 374 | |
| 375 | |
| 376 | Parameters |
| 377 | ---------- |
| 378 | phi : ndarray, shape (size(A), ) |
| 379 | Intercept of the solution at the current iteration |
| 380 | delta : ndarray, shape (size(A), ) |
| 381 | Slope of the solution at the current iteration |
| 382 | current_gamma : float |
| 383 | Value of the regularization parameter at the beginning of the \ |
| 384 | current iteration |
| 385 | |
| 386 | Returns |
| 387 | ------- |
| 388 | next_removal_gamma : float |
| 389 | Gamma value if a variable is removed at the next iteration |
| 390 | next_removal_index : int |
| 391 | Index of the variable to be removed at the next iteration |
| 392 | |
| 393 | |
| 394 | .. _references-regpath: |
| 395 | References |
| 396 | ---------- |
| 397 | .. [41] Chapel, L., Flamary, R., Wu, H., Févotte, C., and Gasso, G. (2021). |
| 398 | Unbalanced optimal transport through non-negative penalized |
| 399 | linear regression. NeurIPS. |
| 400 | """ |
| 401 | r_candidate = phi / (delta - 1e-16) |
| 402 | r_candidate[r_candidate >= (1 - 1e-8) * current_gamma] = 0 |
| 403 | return np.max(r_candidate), np.argmax(r_candidate) |
| 404 | |
| 405 | |
| 406 | def complement_schur(M_current, b, d, id_pop): |
no test coverage detected