The regularized_optimization submodule#
This submodule contains functions to learn an MHN.
- mhn.training.regularized_optimization.learn_mhn(states: StateContainer, score_func: Callable, jacobi: Callable, init: ndarray | None = None, lam: float = 0, maxit: int = 5000, trace: bool = False, reltol: float = 1e-07, round_result: bool = True, callback: Callable | None = None) OptimizeResult#
Trains an MHN.
- Parameters:
states (StateContainer) – A container object holding all mutation states observed in the data.
score_func (Callable) – The score function used for training.
jacobi (Callable) – The gradient function used for training.
init (np.ndarray, optional) – Initial theta for training. If None is given, an independence model is used. Defaults to None.
lam (float, optional) – Regularization tuning parameter lambda. Defaults to 0.
maxit (int, optional) – Maximum number of training iterations. Defaults to 5000.
trace (bool, optional) – If True, prints convergence messages (see scipy.optimize.minimize). Defaults to False.
reltol (float, optional) – Gradient norm threshold for successful termination (see “gtol” in scipy.optimize.minimize). Defaults to 1e-07.
round_result (bool, optional) – If True, rounds the result to two decimal places. Defaults to True.
callback (Callable, optional) – A function called after each iteration, taking theta as an argument. Defaults to None.
- Returns:
The result of the optimization containing the trained model.
- Return type:
OptimizeResult