Fitting Solution Model Parameters to Data¶
Overview¶
BurnMan implements completely general nonlinear least squares fitting routines
in the function burnman.optimize.eos_fitting.nonlinear_least_squares_fit().
This function takes an instance of a burnman.optimize.nonlinear_fitting.NonLinearModel
as input, along with data to be fit, and returns best-fit parameters along with
uncertainties.
For many users, the process of constructing the NonLinearModel class may be unfamiliar and tedious. To facilitate fitting solution parameters to data, BurnMan provides a helper function that constructs NonLinearModel instances so that users can easily fit solution parameters to data.
Available Fitting Functions¶
- burnman.optimize.eos_fitting.fit_XPTp_data(solution, fit_params, flags, data, data_covariances=[], mle_tolerances=[], param_tolerance=1e-05, delta_params=None, bounds=None, max_lm_iterations=50, param_priors=None, param_prior_inv_cov_matrix=None, verbose=True)[source]
Given a symmetric solution, a list of fit parameters and a set of P-T-property points and (optional) uncertainties, this function returns a list of optimized parameters and their associated covariances, fitted using the scipy.optimize.curve_fit routine.
- Parameters:
solution (
burnman.Solution) – Solution for which the parameters should be optimized.fit_params (list of lists) – Variables to be optimized during fitting. Each list is either of length two or three. The first item of length-2 lists should be a dictionary key contained in one of the endmember mineral.params, and the second item should be the index of the endmember in the solution (indexing starts from 0). The first item of length-3 lists should be one of ‘E’, ‘S’ or ‘V’ (the excess energies, entropies or volumes in each binary). The second two items should be the indices of the pair of endmembers bounding the binary, in ascending order (indexing starts from 0). Initial guesses are taken from the existing values for the parameters.
flags (string or list of strings) – Attribute names for the property to be fit for the whole dataset or each datum individually (e.g. ‘V’)
data (2D numpy.array) – Observed X-P-T-property values
data_covariances (3D numpy.array) – X-P-T-property covariances (optional). If not given, all covariance matrices are chosen such that all data points have equal weight, with all error in the pressure.
mle_tolerances (numpy.array) – Tolerances for termination of the maximum likelihood iterations (optional).
param_tolerance (float) – Fractional tolerance for termination of the nonlinear optimization (optional).
delta_params (numpy.array) – Initial values for the change in parameters (optional).
bounds (2D numpy.array) – Minimum and maximum bounds for the parameters (optional). The shape must be (n_parameters, 2).
max_lm_iterations (int) – Maximum number of Levenberg-Marquardt iterations.
verbose (bool) – Whether to print detailed information about the optimization to screen.
- Returns:
Model with optimized parameters.
- Return type: