Skip to content

Conversation

@r3kste
Copy link
Collaborator

@r3kste r3kste commented Dec 3, 2025

Summary of Changes

  1. Added the line_plot and grid_line_plot function for altair.
  2. Added a small example in the documentation to show the altair plot.

Plot Comparision

Plotly Altair
paramsplotly visualization
convergenceplotly visualization

Checklist

  • Documentation
  • Tests
  • Comparision of plot outputs

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/optimagic/config.py 100.00% <100.00%> (ø)
src/optimagic/visualization/backends.py 99.59% <100.00%> (+0.17%) ⬆️
src/optimagic/visualization/convergence_plot.py 95.65% <ø> (ø)
src/optimagic/visualization/history_plots.py 95.78% <ø> (ø)
src/optimagic/visualization/profile_plot.py 91.52% <ø> (ø)
src/optimagic/visualization/slice_plot.py 96.12% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@r3kste
Copy link
Collaborator Author

r3kste commented Dec 5, 2025

The failing tests are still due to

ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device

Looks like bayes_optim library requires torch>=2.0.1. But on linux, CI installs the cuda version of torch which also attempts to install large nvidia/cuda libraries.

In a fresh environment without bayes_optim, installing the cpu version of torch before installing bayes_optim skips the installation of the cuda libraries. Indeed, all Windows and Macos tests are passing as they install the cpu version of torch. So, I believe this could be the ideal solution. However, I wasn't able to specify/control the order in which the libraries are installed by pip. Moreover, this doesn't explain why these failures have started appearing recently (even in other PRs).

@r3kste r3kste requested a review from timmens December 5, 2025 14:41
@timmens
Copy link
Member

timmens commented Dec 6, 2025

Great investigative work! Have you tried adding the conda-forge version pytorch-cpu to the conda environment? The conda enviromment should be solved and installed before the pip environment. However, it could be that pip simply ignores this and downloads the torch dependency again.

@r3kste
Copy link
Collaborator Author

r3kste commented Dec 6, 2025

Great! Adding pytorch-cpu as a conda dependency seems to have worked. Would you prefer it to be done in a separate PR instead of this one?

The two tests failing currently are unrelated but they seem to persist even after multiple re-runs. One of them is due to comparison of positive zero with negative zero similar to #642.

File "how_to/how_to_constraints.md", line 327, in how_to_constraints.md
Failed example:
    res.params.round(3)
Expected:
    array([ 1. ,  0.8,  0.6,  0.4,  0.2, -0. ])
Got:
    array([1. , 0.8, 0.6, 0.4, 0.2, 0. ])

The other one is due to the actual not being close enough to the expected. I'm not entirely sure what causes this.

ACTUAL: array([0.188, 0.006, 0.011])
DESIRED: array([0.19 , 0.006, 0.011])

@timmens
Copy link
Member

timmens commented Dec 6, 2025

Yes, please open another PR to fix this. We will see whether the two mentioned issues persist there. Thanks!

@r3kste
Copy link
Collaborator Author

r3kste commented Dec 6, 2025

@timmens Sure. I have opened #656.

Copy link
Member

@timmens timmens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far, the only issue I see is that the altair plot is not rendered in the documentation.

Could you check whether its possible to render the chart as a static image (png or svg) for the docs? I believe you must add a dependency to the rtd_environment in this case.

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants