Skip to content

Refactor and extend History class #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Feb 5, 2025
Merged

Refactor and extend History class #552

merged 35 commits into from
Feb 5, 2025

Conversation

timmens
Copy link
Member

@timmens timmens commented Nov 30, 2024

  • Remove HistoryArrays class and add these methods to History class
  • Add timing module that contains functionality to create CostModels (as described Improve runtime measures for criterion plot and benchmarking plots #547)
  • Add new methods and properties to History class, most importantly fun_data and params_data, which return tidy data frames of the function evaluations and a user-selected time measure.
  • Check visually that plots have not changed!

Note

  1. For the history processing for visualizations (history_plots.py), we must wait for Align plotting from logs and results #553
  2. For the usage of the new methods fun_data and params_data in the visualization code we will also wait for Align plotting from logs and results #553

Copy link

codecov bot commented Nov 30, 2024

Codecov Report

Attention: Patch coverage is 97.39130% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/optimagic/optimization/history.py 96.51% 6 Missing ⚠️
Files with missing lines Coverage Δ
src/optimagic/__init__.py 100.00% <100.00%> (+6.66%) ⬆️
src/optimagic/benchmarking/run_benchmark.py 92.30% <100.00%> (ø)
src/optimagic/optimization/convergence_report.py 100.00% <100.00%> (ø)
...agic/optimization/internal_optimization_problem.py 95.66% <100.00%> (+0.44%) ⬆️
src/optimagic/optimization/process_results.py 94.11% <100.00%> (-0.17%) ⬇️
src/optimagic/timing.py 100.00% <100.00%> (ø)
src/optimagic/visualization/history_plots.py 90.84% <100.00%> (+0.12%) ⬆️
src/optimagic/optimization/history.py 93.63% <96.51%> (+6.67%) ⬆️

... and 2 files with indirect coverage changes

@timmens timmens changed the title Incorporate HistoryArray in History Refactor History class Dec 1, 2024
@timmens timmens changed the title Refactor History class Refactor and extend History class Dec 1, 2024
@timmens timmens requested a review from janosg December 5, 2024 11:09
@timmens
Copy link
Member Author

timmens commented Feb 4, 2025

The new plotly version (6.0.0) seems to have a bug. I had to restrict it. I could not find a MRE quickly. However, I already found out that the problem stems from these lines:

# plotting_utilities.py[100-106]
    if share_yrange_all:
        lb = []
        ub = []
        for f in plots:
            for d in f.data:
>               lb.append(np.min(d["y"]))
>               ub.append(np.max(d["y"]))

The problem seems to be that d["y"] (and for that matter also d["x"] a few lines below) return a dictionary instead of a list of floats.

@timmens timmens merged commit 567464d into main Feb 5, 2025
22 checks passed
@timmens timmens deleted the remote-history-arrays branch February 5, 2025 16:15
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