Skip to content
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

Profile: improve profiling code #1447

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f05dce9
Initial working update
Doresic Aug 8, 2024
a465b62
Add TODOs
Doresic Aug 8, 2024
2b02b9a
Introduce adaptive max and min steps
Doresic Aug 8, 2024
275c890
Fix flags for exiting the "trust area"
Doresic Aug 9, 2024
e2480bc
Bugfixes, Robustness, Logging, Better plotting
Doresic Aug 14, 2024
8ce9890
Merge branch 'develop' into change_profiling
Doresic Aug 14, 2024
ee0aea9
Fix default value for color_path
Doresic Aug 14, 2024
75f3964
Fix color value issues -- failing tests
Doresic Aug 15, 2024
5c911de
Add tuple to isinstance list
Doresic Aug 15, 2024
3cf940b
No color_path plotting if color requested
Doresic Aug 15, 2024
a500750
Fix if statements fixed_method
Doresic Aug 15, 2024
6914d19
We're making more steps then before
Doresic Aug 15, 2024
9093474
Change default magic and max values
Doresic Sep 24, 2024
7c77a1b
Change default method, remove TODOs
Doresic Sep 24, 2024
f61e61e
Merge branch 'develop' into change_profiling
Doresic Sep 24, 2024
c8000d2
Update quality colors
Doresic Sep 24, 2024
08b7e2e
Fix failing test
Doresic Sep 24, 2024
5e06be9
Fix test and docstring
Doresic Sep 25, 2024
6525578
Merge branch 'develop' into change_profiling
Doresic Sep 25, 2024
eeb304d
Rewrite some too long if statements
Doresic Sep 25, 2024
c65b199
Merge branch 'change_profiling' of https:/ICB-DCM/pyPESTO…
Doresic Sep 25, 2024
beee8d9
Some more if statements cleanup
Doresic Sep 25, 2024
1d80988
Change color if no
Doresic Sep 26, 2024
440319b
Merge branch 'develop' into change_profiling
Doresic Sep 26, 2024
814f552
Merge branch 'develop' into change_profiling
Doresic Sep 26, 2024
7627288
Correct y-axis in obj.fun plotting
Doresic Sep 30, 2024
5e86392
Merge branch 'develop' into change_profiling
PaulJonasJost Oct 8, 2024
3c8ccd5
Paul review changes
Doresic Oct 8, 2024
c7697e9
More Paul review changes
Doresic Oct 8, 2024
7d8b50c
Merge branch 'develop' into change_profiling
PaulJonasJost Oct 9, 2024
9d74b84
Fix if-while infinite loop bug
Doresic Oct 9, 2024
93250b9
Merge branch 'develop' into change_profiling
Doresic Oct 10, 2024
41411f3
Correct comment variable name
Doresic Oct 17, 2024
649c53c
Change i_color to color_i
Doresic Oct 17, 2024
abae4e8
Change docstring of color in lowlevel
Doresic Oct 17, 2024
8ef3b51
Expand colors docstring
Doresic Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pypesto/profile/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ def __init__(
self,
default_step_size: float = 0.01,
min_step_size: float = 0.001,
max_step_size: float = 1.0,
max_step_size: float = 0.1,
step_size_factor: float = 1.25,
delta_ratio_max: float = 0.1,
ratio_min: float = 0.145,
reg_points: int = 10,
reg_order: int = 4,
magic_factor_obj_value: float = 0.5,
magic_factor_obj_value: float = 1.5,
whole_path: bool = False,
):
super().__init__()
Expand Down Expand Up @@ -112,5 +112,5 @@ def validate(self):
if self.default_step_size < self.min_step_size:
raise ValueError("default_step_size must be >= min_step_size.")

if self.magic_factor_obj_value < 0 or self.magic_factor_obj_value >= 1:
raise ValueError("magic_factor_obj_value must be >= 0 and < 1.")
if self.magic_factor_obj_value < 1:
raise ValueError("magic_factor_obj_value must be > 1.")
Copy link
Contributor Author

@Doresic Doresic Sep 25, 2024

Choose a reason for hiding this comment

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

The magic factor now should be larger than 1 rather than between 0 and 1. The next_obj_target now depends on the objective function value difference of the last two profile points, rather than the difference of the last profile point to the global minimum. The former is in general much smaller than the latter, so we want to increase it rather than decrease it using a factor.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a better name for this? magic_factor sounds fun but is rather uninformative. Also: if it stays like that, documentation in line 35-37 needs to be adjusted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True...
It is kinda the scaling factor of the adaptive target value.
Changed to adaptive_target_scaling_factor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Take a look at the documentation of it in ProfileOptions. Not sure if informative enough.

6 changes: 5 additions & 1 deletion pypesto/profile/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def parameter_profile(
profile_index: Iterable[int] = None,
profile_list: int = None,
result_index: int = 0,
next_guess_method: Union[Callable, str] = "adaptive_step_regression",
next_guess_method: Union[Callable, str] = "adaptive_step_order_1",
Doresic marked this conversation as resolved.
Show resolved Hide resolved
profile_options: ProfileOptions = None,
progress_bar: bool = None,
filename: Union[str, Callable, None] = None,
Expand Down Expand Up @@ -104,6 +104,8 @@ def create_next_guess(
current_profile_,
problem_,
global_opt_,
min_step_increase_factor_,
max_step_reduce_factor_,
Doresic marked this conversation as resolved.
Show resolved Hide resolved
):
return next_guess(
x,
Expand All @@ -114,6 +116,8 @@ def create_next_guess(
current_profile_,
problem_,
global_opt_,
min_step_increase_factor_,
max_step_reduce_factor_,
)

elif callable(next_guess_method):
Expand Down
Loading
Loading