Skip to content

add low level 2d profile plot function and 2d profile function#1652

Open
EchoRLiu wants to merge 4 commits intodevelopfrom
1651-profiles-do-not-show-if-dropoff-due-to-bound-hitting
Open

add low level 2d profile plot function and 2d profile function#1652
EchoRLiu wants to merge 4 commits intodevelopfrom
1651-profiles-do-not-show-if-dropoff-due-to-bound-hitting

Conversation

@EchoRLiu
Copy link
Copy Markdown
Collaborator

@EchoRLiu EchoRLiu commented Dec 4, 2025

This PR is to address #1651.

To do so, I added two new visualization functions:

  1. profile_lowlevel_2d() - Visualizes the relationship between two parameters during profiling
  • Shows one profiled parameter on the x-axis and tracks a second parameter on the y-axis
  • Uses color mapping (via scatter plot) to indicate objective ratio or function values along the profile path
  1. visualize_2d_profile() - High-level n by n profile grid:
  • Diagonal plots: Shows traditional 1D profiles for each parameter
  • Off-diagonal plots: Shows 2D parameter relationships during profiling using profile_lowlevel_2d()

This would provide a complete overview of how parameters interact during profile likelihood computation

@EchoRLiu EchoRLiu requested a review from Doresic December 4, 2025 15:19
@EchoRLiu EchoRLiu self-assigned this Dec 4, 2025
@EchoRLiu EchoRLiu added enhancement New feature or request visualization Related to any visualization profiling Related to profiling labels Dec 4, 2025
@EchoRLiu EchoRLiu linked an issue Dec 4, 2025 that may be closed by this pull request
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 4, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 82.56881% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.34%. Comparing base (4a69619) to head (b00bcd1).

Files with missing lines Patch % Lines
pypesto/visualize/profiles.py 82.40% 19 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1652      +/-   ##
===========================================
+ Coverage    84.33%   84.34%   +0.01%     
===========================================
  Files          164      164              
  Lines        14340    14448     +108     
===========================================
+ Hits         12093    12186      +93     
- Misses        2247     2262      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Doresic added 2 commits March 9, 2026 16:05
- Fix colorbar layout using constrained_layout (no more overlap)
- Always extend axes to parameter bounds; remove show_bounds parameter
- Auto-generate scale-aware axis labels from problem.x_scales
- Accept optional x_labels override to match 1D profiles API
- Pairplot-style label cleanup: parameter names on edges only, ratio
  label kept on off-edge diagonal subplots
- Reset MaxNLocator on diagonal subplots to avoid dense tick marks
- Add smoke tests for visualize_2d_profile and profile_lowlevel_2d
- Add 2D profile cell to getting_started.ipynb
@Doresic
Copy link
Copy Markdown
Contributor

Doresic commented Mar 9, 2026

Remaining TODO list from @EchoRLiu

TODO List for still needed improvements:

  • there is some weird jumps when doing profile

This will be taken care of in the another PR dealing with profiling enhancements.

  • some range can not be profiled

This is weird, I saw it a couple of times. We'll need to check what happens, why does profiling stop prematurely sometimes. It might be the weird conditions in adaptive searches that doesn't have a else, so profiling can fail silently. Needs to be investigated.

  • color scheme can be improved

Good as initial visualization, can be changed via user.

  • original profile function can also be improved with threshold

For another PR as it deals with general profiling.

- Compute global vmin/vmax across all off-diagonal panels so the
  colorbar accurately represents all subplots
- Add profile_color parameter for diagonal 1D profile line color
- Add vmin/vmax parameters to profile_lowlevel_2d for external control
@Doresic Doresic marked this pull request as ready for review March 9, 2026 16:28
@dweindl
Copy link
Copy Markdown
Member

dweindl commented Mar 11, 2026

Thanks, looks mostly good to me.

Two minor things looking at https://pypesto--1652.org.readthedocs.build/en/1652/example/getting_started.html:
image

  • I find the top-left y-label confusing. how about showing all y-labels, or at least always for the first, the diagonal, and the first off-diagonal subplot?
  • the markers in the off-diagonal plots look all black. I guess this is just due to the overlap here. it might be preferable to plot them from low to high log-posterior ratio or setting the z-order accordingly.

Copy link
Copy Markdown
Collaborator

@PaulJonasJost PaulJonasJost left a comment

Choose a reason for hiding this comment

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

One thing that is bugging me a bit is that if we have a lot of points in a small intervall, the black borders of the point overshadow the coloring.

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

Labels

enhancement New feature or request profiling Related to profiling visualization Related to any visualization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Profiles do not show if dropoff due to bound hitting

5 participants