cofi.utils.ModelCovariance#

class cofi.utils.ModelCovariance[source]#

CoFI’s utility abstract class to calculate model prior distribution

See GaussianPrior for a concrete subclass example.

Reference Details

__call__(model: ndarray) Number#

a class instance itself can also be called as a function

It works exactly the same as reg.

In other words, the following two usages are exactly the same:

>>> my_reg = QuadraticReg(factor=1, model_size=3)
>>> my_reg_value = my_reg(np.array([1,2,3]))            # usage 1
>>> my_reg_value = my_reg.reg(np.array([1,2,3]))        # usage 2
abstract gradient(model: ndarray) ndarray#

the gradient of regularization function with respect to model given a model

The usual size for the gradient is \((M,)\) where \(M\) is the number of model parameters

abstract hessian(model: ndarray) ndarray#

the hessian of regularization function with respect to model given a model

The usual size for the Hessian is \((M,M)\) where \(M\) is the number of model parameters

abstract reg(model: ndarray) Number#

the regularization function value given a model to evaluate

model_shape#

the shape of models that current regularization function accepts

model_size#

the number of unknowns that current regularization function accepts

back to top