replay_trajectory_classification.core.check_converged#
- check_converged(log_likelihood: ndarray, previous_log_likelihood: ndarray, tolerance: float = 0.0001) Tuple[bool, bool][source]#
We have converged if the slope of the log-likelihood function falls below ‘tolerance’,
i.e., |f(t) - f(t-1)| / avg < tolerance, where avg = (|f(t)| + |f(t-1)|)/2 and f(t) is log lik at iteration t.
- Parameters:
log_likelihood (np.ndarray) – Current log likelihood
previous_log_likelihood (np.ndarray) – Previous log likelihood
tolerance (float, optional) – threshold for similarity, by default 1e-4
- Returns:
is_converged (bool)
is_increasing (bool)