simrun
❭ modular_reduced_model_inference
❭ strategy
❭ _Strategy
_Strategy¶
- class simrun.modular_reduced_model_inference.strategy._Strategy(name)¶
Strategy base class.
This class is used to define a strategy for the optimizer. Each strategy sets up all necessary components to define a single cost function
get_score()
. This cost function is used by asimrun.modular_reduced_model_inference.solver
to optimize the parameters of the strategy.Each child class must implement a
_get_score
class method. These are used here to constructget_score()
. It is this get_score method that is optimized during optimization.As a function of the parameters, compute a value for each trial. The optimizer will optimize for this value (highest AUROC score)
Needs some repr for input data.
E.G. A strategy that needs to optimize for AP refractory, then the Strategy needs to incorporate this data
_get_score
(x)Compute the score for the given parameters x.
setup
(data, DataSplitEvaluation)Setup the strategy with the given data.
_setup
()Strategy-specific setup.
_get_x0
()Get an initial guess for the learnable weights of the basis functions \(\mathbf{x}\).
set_split
(split, setup)Set the split for this strategy.
get_score_static
(_get_score, x, cupy_split)static Convert the strategy-specific
_get_score
method to a static method.get_y_static
(y, numpy_split)static Fetch the labels for the given split.
_objective_function_static
(get_score, get_y, x)static Compute the objective value for the given parameters x.
add_solver
(solver, setup)Add a solver to the strategy.