lisa_noise.inference.mle ======================== .. py:module:: lisa_noise.inference.mle Classes ------- .. autoapisummary:: lisa_noise.inference.mle.MLEResult Functions --------- .. autoapisummary:: lisa_noise.inference.mle.find_mle lisa_noise.inference.mle.find_mle_zoom Module Contents --------------- .. py:class:: MLEResult Holds the result of an MLE optimisation run. .. py:attribute:: x :type: numpy.ndarray .. py:attribute:: log_likelihood :type: float .. py:attribute:: converged :type: bool .. py:attribute:: nit :type: int .. py:function:: find_mle(log_likelihood_fn: Callable, x0: numpy.ndarray, bounds: lisa_noise.types.Bounds, tol: float = 1e-08, maxiter: int = 2000, verbose: bool = False, x_ref: numpy.ndarray | None = None, use_jax: bool = False) -> MLEResult Single-start MLE via L-BFGS-B. Good for warm-starting from a previous segment. If x_ref is provided and the primary result has lower log-likelihood than log_likelihood_fn(x_ref), the optimiser re-runs from x_ref automatically. :param log_likelihood_fn: A function that takes a parameter vector and returns the log-likelihood. :type log_likelihood_fn: Callable :param x0: Initial guess for the optimiser. :type x0: np.ndarray :param bounds: Tuple of (lower_bounds, upper_bounds) for the parameters. :type bounds: Bounds :param tol: Gradient-norm tolerance for convergence. :type tol: float :param maxiter: Maximum number of iterations. :type maxiter: int :param verbose: If True, print L-BFGS-B progress to stdout. :type verbose: bool :param x_ref: Optional reference point. If the result is worse than logL(x_ref), the optimiser re-runs from x_ref. :type x_ref: np.ndarray or None :param use_jax: If True, use JAX autodiff for exact gradients. If False (default), let scipy estimate gradients numerically. :type use_jax: bool :rtype: MLEResult .. py:function:: find_mle_zoom(log_likelihood_fn: Callable, bounds: lisa_noise.types.Bounds, *, n_rounds: int = 3, n_starts: int = 100, zoom_factor: float = 0.5, top_k: int = 3, rng: numpy.random.Generator | None = None, tol: float = 1e-08, polish_tol: float = 1e-14, maxiter: int = 2000, use_jax: bool = False) -> MLEResult Multi-round zooming MLE. Keeps top-K converged results per round as new centres, shrinks windows by zoom_factor, then fine tunes the global best at tight tolerance. :param log_likelihood_fn: A function that takes a parameter vector and returns the log-likelihood. :type log_likelihood_fn: Callable :param bounds: Tuple of (lower_bounds, upper_bounds) for the parameters. :type bounds: Bounds :param n_rounds: Number of zoom rounds to perform. :type n_rounds: int :param n_starts: Total number of random initial points to try across all rounds (divided among centres). :type n_starts: int :param zoom_factor: Factor by which to shrink the search windows each round (e.g., 0.5 halves the width). :type zoom_factor: float :param top_k: Number of top results to keep as centres for the next round. :type top_k: int :param rng: Optional random number generator for reproducibility. If None, a new generator is created. :type rng: np.random.Generator | None :param tol: Tolerance for convergence (gradient norm) in the zoom rounds. :type tol: float :param polish_tol: Tolerance for convergence in the final polishing phase. :type polish_tol: float :param maxiter: Maximum number of iterations for the optimiser in both the zoom rounds and polishing phase. :type maxiter: int :param use_jax: If True, use JAX autodiff for exact gradients. If False (default), let scipy estimate gradients numerically. :type use_jax: bool :rtype: MLEResult