Skip to content

[MRG] Fix UCOOT partial init_duals crash, replace prints with errors/warnings, docstring fixes - #888

Open
agramfort wants to merge 4 commits into
PythonOT:masterfrom
agramfort:review-improvements
Open

agramfort wants to merge 4 commits into
PythonOT:masterfrom
agramfort:review-improvements

Conversation

@agramfort

Copy link
Copy Markdown
Collaborator

Types of changes

  • Bug fix
  • Documentation fixes
  • Maintenance (pre-commit config, lint)

Motivation and context / Related issue

A small set of fixes from a review of the package. It contains no API redesign.

Bug fix

  • ot.gromov.fused_unbalanced_across_spaces_divergence: the loop over [duals_samp, duals_feat] always unpacked duals_feat. As a result, init_duals=(duals_samp, None) crashed with a TypeError, and duals_samp was never used for backend detection, although the code further down explicitly supports partial duals.

Raise or warn instead of print

  • ot.datasets.make_data_classif now raises ValueError on an unknown dataset (it used to print and return dummy arrays).
  • ot.stochastic.solve_semi_dual_entropic now raises ValueError on an unknown method (it used to print and return None).
  • ot.mapping.nearest_brenier_potential_* now raise ImportError when CVXPY is missing (they used to print and return None).
  • ot.gaussian.bures_barycenter_fixpoint, ot.regpath and the entropic partial Wasserstein solver now emit UserWarning instead of printing.

Docs

  • Fixed docstring parameters that did not match the signature:
    • epsilon → reg, a stale assume_inner_convergence entry and the wrong grad default in solve_gromov_batch
    • numItermax → numIterMax in empirical_sinkhorn*
    • log → use_log in GW dictionary learning
    • other wrong or stale names: d_instrinsic, weights/tplt_weights, K_1/K_2, v/beta and list_p2
    • removed entries for parameters that no longer exist
    • removed duplicated entries
  • Fixed b being described as "source domain" in ot.solve/ot.solve_sample.
  • Fixed typos, and a broken .hmtl link in the README.

Maintenance

  • .pre-commit-config.yaml: the ruff hook for docs/examples/tests used the pattern ^examples/^test/ (missing |), so it never matched, and the ruff-format pattern ended in |, which matches every file. The second commit fixes the 18 lint errors already present in test/ that the corrected hook now reports.

How has this been tested (if it applies)

  • New regression tests: test_partial_init_duals (UCOOT), invalid method in solve_semi_dual_entropic, unknown dataset (test/test_datasets.py), the non-convergence warning in bures_barycenter_fixpoint, and the max-iteration warning in regularization_path.
  • Ran locally: datasets, regpath, stochastic, gaussian, ucoot, mapping, partial, smooth, dr, da, quantized GW, solvers, sliced, ot, batch, backend, bspot, sgot, utils, lowrank, gromov dictionary and gnn. All pass.
  • ruff check and ruff format --check (0.5.2, as pinned in pre-commit) pass on ot/ and test/.

PR checklist

  • I have read the CONTRIBUTING document.
  • The documentation is up-to-date with the changes I made (check build artifacts).
  • All tests passed, and additional code has been covered with new tests.
  • I have added the PR and Issue fix to the RELEASES.md file.

🤖 Generated with Claude Code

…gs, fix docstrings

- Fix fused_unbalanced_across_spaces_divergence crashing when only one of
  the sample/feature dual pairs is passed in init_duals
- Raise ValueError/ImportError instead of printing and returning None or
  dummy values (make_data_classif, solve_semi_dual_entropic,
  nearest_brenier_potential_*), and warn instead of print in
  bures_barycenter_fixpoint, regpath and entropic partial Wasserstein
- Fix docstring parameters that do not match signatures, wrong defaults
  and typos
- Fix file patterns of ruff hooks in .pre-commit-config.yaml
@agramfort agramfort changed the title [WIP] Fix UCOOT partial init_duals crash, replace prints with errors/warnings, docstring fixes [MRG] Fix UCOOT partial init_duals crash, replace prints with errors/warnings, docstring fixes Oct 11, 2026
Ignore E402 for docs/examples/tests since sphinx-gallery examples import
modules in later sections on purpose.
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.04%. Comparing base (604c47f) to head (d12c547).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #888      +/-   ##
==========================================
+ Coverage   97.00%   97.04%   +0.04%     
==========================================
  Files         128      129       +1     
  Lines       26349    26385      +36     
==========================================
+ Hits        25559    25606      +47     
+ Misses        790      779      -11     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant