mesmer.distrib.ConditionalDistribution.fit#
- ConditionalDistribution.fit(predictors, target, weights, first_guess, *, sample_dim='sample', smooth_coeffs=False, r_gasparicohn=500, on_failed_fit='error')#
fit conditional distribution over all gridpoints.
- Parameters:
predictors (dict of xr.DataArray | xr.Dataset) – A dict of DataArray objects used as predictors or a Dataset, holding each predictor as a data variable. Each predictor must be 1D and contain sample_dim.
target (xr.DataArray) – Target DataArray.
weights (xr.DataArray.) – Individual weights for each sample.
first_guess (xr.Dataset) – First guess for the coefficients, each coefficient is a data variable in the Dataset and has the corresponding name of the coefficient in the expression.
sample_dim (str) – Dimension along which to fit the distribution.
smooth_coeffs (bool, default: False) – If True, smooth the provided coefficients using a weighted median. The weights are the correlation matrix of the Gaspari-Cohn function. This is typically used for the 2nd round of the fit.
r_gasparicohn (float, default: 500) – Radius used to compute the correlation matrix of the Gaspari-Cohn function. Used if
smooth_coeffsis True.on_failed_fit (“error” | “ignore”, default: “error”) – Behaviour when the fit fails. Careful: currently the using “ignore” returns the first guess.
- Returns:
xr.Dataset– Fitted coefficients of the conditional distribution (gridpoint, coefficient)