Profile

pypesto.profile.parameter_profile(problem, result, optimizer, profile_index=None, profile_list=None, result_index=0, next_guess_method=None, profile_options=None, optimize_options=None) → pypesto.result.Result

This is the main function to call to do parameter profiling.

Parameters:
  • problem (pypesto.Problem) – The problem to be solved.
  • result (pypesto.Result) – A result object to initialize profiling and to append the profiling results to. For example, one might append more profiling runs to a previous profile, in order to merge these. The existence of an optimization result is obligatory.
  • optimizer (pypesto.Optimizer) – The optimizer to be used along each profile.
  • profile_index (ndarray of integers, optional) – array with parameter indices, whether a profile should be computed (1) or not (0) Default is all profiles should be computed
  • profile_list (integer, optional) – integer which specifies whether a call to the profiler should create a new list of profiles (default) or should be added to a specific profile list
  • result_index (integer, optional) – index from which optimization result profiling should be started (default: global optimum, i.e., index = 0)
  • next_guess_method (callable, optional) – function handle to a method that creates the next starting point for optimization in profiling.
  • profile_options (pypesto.ProfileOptions, optional) – Various options applied to the profile optimization.
  • optimize_options (pypesto.OptimizeOptions, optional) – Various options applied to the optimizer.
class pypesto.profile.ProfileOptions(default_step_size=0.01, min_step_size=0.001, max_step_size=1.0, step_size_factor=1.25, delta_ratio_max=0.1, ratio_min=0.145, reg_points=10, reg_order=4, magic_factor_obj_value=0.5)

Bases: dict

Options for optimization based profiling.

Parameters:
  • default_step_size (float, optional) – default step size of the profiling routine along the profile path (adaptive step lengths algorithms will only use this as a first guess and then refine the update)
  • min_step_size (float, optional) – lower bound for the step size in adaptive methods
  • max_step_size (float, optional) – upper bound for the step size in adaptive methods
  • step_size_factor (float, optional) – Adaptive methods recompute the likelihood at the predicted point and try to find a good step length by a sort of line search algorithm. This factor controls step handling in this line search
  • delta_ratio_max (float, optional) – maximum allowed drop of the posterior ratio between two profile steps
  • ratio_min (float, optional) – lower bound for likelihood ratio of the profile, based on inverse chi2-distribution. The default corresponds to 95% confidence
  • reg_points (float, optional) – number of profile points used for regression in regression based adaptive profile points proposal
  • reg_order (float, optional) – maximum dregee of regriossion polynomial used in regression based adaptive profile points proposal
  • magic_factor_obj_value (float, optional) – There is this magic factor in the old profiling code which slows down profiling at small ratios (must be >= 0 and < 1)
__init__(default_step_size=0.01, min_step_size=0.001, max_step_size=1.0, step_size_factor=1.25, delta_ratio_max=0.1, ratio_min=0.145, reg_points=10, reg_order=4, magic_factor_obj_value=0.5)

Initialize self. See help(type(self)) for accurate signature.

static create_instance(maybe_options)

Returns a valid options object.

Parameters:maybe_options (OptimizeOptions or dict) –
class pypesto.profile.ProfilerResult(x_path, fval_path, ratio_path, gradnorm_path=None, exitflag_path=None, time_path=None, time_total=0.0, n_fval=0, n_grad=0, n_hess=0, message=None)

Bases: dict

The result of a profiler run. The standardized return return value from pypesto.profile, which can either be initialized from an OptimizerResult or from an existing ProfilerResult (in order to extent the compputation).

Can be used like a dict.

x_path

ndarray – The path of the best found parameters along the profile (Dimension: n_par x n_profile_points)

fval_path

ndarray – The function values, fun(x), along the profile.

ratio_path

ndarray – The ratio of the posterior function along the profile.

gradnorm_path

ndarray – The gradient norm along the profile.

exitflag_path

ndarray – The exitflags of the optimizer along the profile.

time_path

ndarray – The computation time of the optimizer runs along the profile.

time_total

ndarray – The total computation time for the profile.

n_fval

int – Number of function evaluations.

n_grad

int – Number of gradient evaluations.

n_hess

int – Number of Hessian evaluations.

message

str – Textual comment on the profile result.

Notes

Any field not supported by the profiler or the profiling optimizer is filled with None. Some fields are filled by pypesto itself.

__init__(x_path, fval_path, ratio_path, gradnorm_path=None, exitflag_path=None, time_path=None, time_total=0.0, n_fval=0, n_grad=0, n_hess=0, message=None)

Initialize self. See help(type(self)) for accurate signature.

append_profile_point(x, fval, ratio, gradnorm=nan, exitflag=nan, time=nan, n_fval=0, n_grad=0, n_hess=0)

This function appends a new OptimizerResult to an existing ProfilerResults

flip_profile()

This function flips the profiling direction (left-right) Profiling direction needs to be changed once (if the profile is new) and twice, if we append to an existing profile