The estimation Module¶
- stat_fem.estimation.estimate_params_MAP(A, b, G, data, priors=[None, None, None], start=None, ensemble_comm=<Mock name='mock.COMM_SELF' id='139899221995856'>, **kwargs)¶
Estimate model hyperparameters using MAP estimation
This function uses maximum a posteriori estimation to fit parameters for a Statistical FEM model. The function is a wrapper to the Scipy LBFGS function to minimize the marginal log posterior, returning a fit
LinearSolverobject. This allows re-use of the cached Forcing Covariance function solves for each sensor, which greatly improves efficiency of the computation.Priors on the three hyperparameters can be specified by passing a list of
Prior-derived objects. The priors are over the values as passed directly to all functions (i.e. while still on a logarithmic scale). If no priors are provided, then an uninformative prior is assumed and estimation is based on the marginal log-likelihood.The computations to solve for the forcing covariance can be carried out in parallel by passing a Firedrake Ensemble communicator for the
ensemble_commkeyword argument. All other computations are done on the root process and broadcast to all other processes to ensure that all processes have the same final minimum value when the computation terminates.Additional keyword arguments can be passed to control the minimization routine options or the PETSc solver options. These will be forwarded to the function calls to
scipy.optimize.minimizeorLinearSolver. See the documentation for minimize orLinearSolverfor more details.- Parameters
A (Matrix) – FEM stiffness matrix, must be a Firedrake Matrix class.
b (Function or Vector) – FEM RHS vector, must be a Firedrake Function or Vector
G (ForcingCovariance) – Forcing Covariance matrix, must be a
ForcingCovarianceclass.data (ObsData) – Observational data object, must be a
ObsDataclass.priors (list) – List of prior objects over hyperparameters. Must be a list of length 3 containing
Prior-derived objects orNonefor uninformative priors. Optional, default is[None, None, None](uninformative priors on all parameters).start (None or ndarray) – Starting point for minimization routine. Must be a numpy array of length 3 or
Noneif the starting point is to be drawn randomly. Optional, default isNone.ensemble_comm – MPI communicator for ensemble parallelism created from a Firedrake
Ensembleobject. This controls how the solves over all sensors are parallelized. Optional, default value isCOMM_SELFindicating that forcing covariance solves are not parallelized.kwargs – Additional keyword arguments to be passed to either the Firedrake LinearSolver object or the Scipy minimize routine. See the corresponding manuals for more information.
- Returns
A LinearSolver object with the hyperparameters set to the MAP/MLE value. To extract the actual parameters, use the
paramsattribute.- Return type
LinearSolver