fips.posterior.Solution#

class fips.posterior.Solution(*args, **kwargs)[source]#

Bases: Protocol

What a Posterior asks of the object a method keeps from its solve.

A method solves a Problem and keeps whatever it needs to answer these questions (the analytic method keeps a factorization of its system; a sampling method would keep its samples). Each answer is an unlabeled NumPy array (or a float), in the order of the problem’s spaces: n the state elements (problem.prior), m the observations (problem.obs). The posterior labels them, and computes each one once.

Four members are optional, and a posterior whose solution lacks one says so when it is asked for the feature:

  • with_gamma(gamma) -> Solution: the solution at another regularization factor, without solving again (Posterior.with_gamma()).

  • with_data(problem) -> Solution: the solution of problem, the same problem with other values of the observations, without solving again (Posterior.with_data()).

  • innovation_precision(groups) -> list[np.ndarray]: for each array of observation positions \(g\), the block \(P_{gg}\) of \(P = (H S_0 H^T + S_z/\gamma)^{-1}\) (m_g x m_g), and self_sensitivity() -> np.ndarray: \(\operatorname{diag}(H K)\) (m), whose sum is DOFS (Posterior.data_worth()).

And a solution whose estimate() is the posterior mean says so with a class attribute estimate_is_mean = True; without it, a posterior has no mean. One whose estimate is linear in the observations, \(\hat{x} = x_0 + K (z - H x_0 - c)\) with the \(K\) of gain() whatever the values of \(z\), says so with estimate_is_linear = True; without it, a posterior has no recovery().

See also

Posterior

The labeled answer built on it.

fips.methods

How a method is added.

Methods

chi2()

Return the chi-squared of the solution: the sum of the data and the state misfits.

chi2_tests()

Return Rodgers' four chi-squared tests, each its chi-squared and degrees of freedom.

cov([W])

Return the posterior error covariance of the state, or of aggregates of it.

dofs()

Return the degrees of freedom for signal, \(\operatorname{tr}(K H)\).

dofs_per_element()

Return the diagonal of the averaging kernel, \(\operatorname{diag}(K H)\) (n), whose sum is dofs().

estimate()

Return the point estimate of the state, \(\hat{x}\) (n).

gain([W])

Return the gain \(K\), or \(W K\) for an aggregation.

information()

Return the Shannon information content, \(-\tfrac{1}{2} \ln \lvert I - K H \rvert\), in nats.

variances()

Return the posterior error variances, the diagonal of \(\hat{S}\) (n).