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 37 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
37 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://github.com/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
39a2948
Merge branch 'develop' into change_profiling
Doresic Oct 21, 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
16 changes: 8 additions & 8 deletions pypesto/profile/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class ProfileOptions(dict):
reg_order:
Maximum degree of regression polynomial used in regression based
adaptive profile points proposal.
magic_factor_obj_value:
There is this magic factor in the old profiling code which slows down
profiling at small ratios (must be >= 0 and < 1).
adaptive_target_scaling_factor:
The scaling factor of the next_obj_target in next guess generation.
Larger values result in larger next_guess step size (must be > 1).
whole_path:
Whether to profile the whole bounds or only till we get below the
ratio.
Expand All @@ -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,
adaptive_target_scaling_factor: float = 1.5,
whole_path: bool = False,
):
super().__init__()
Expand All @@ -63,7 +63,7 @@ def __init__(
self.delta_ratio_max = delta_ratio_max
self.reg_points = reg_points
self.reg_order = reg_order
self.magic_factor_obj_value = magic_factor_obj_value
self.adaptive_target_scaling_factor = adaptive_target_scaling_factor
self.whole_path = whole_path

self.validate()
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.adaptive_target_scaling_factor < 1:
raise ValueError("adaptive_target_scaling_factor must be > 1.")
10 changes: 8 additions & 2 deletions 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 @@ -93,7 +93,9 @@ def parameter_profile(
profile_options = ProfileOptions.create_instance(profile_options)
profile_options.validate()

# create a function handle that will be called later to get the next point
# Create a function handle that will be called later to get the next point.
# This function will be used to generate the initial points of optimization
# steps in profiling in `walk_along_profile.py`
if isinstance(next_guess_method, str):

def create_next_guess(
Expand All @@ -104,6 +106,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 +118,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