# Model¶

The model is a class to make accessing log P(X) and grad log P(X) functions easier. Models contain caches for both log P(X) and the gradient. This is intended to be used when building new samplers, users won’t typically need this.

There are two models currently. Model expects separate log P(X) and gradient functions. SingleModel expects one function that returns both log P(x) and the gradient.

Example usage:

def logp(X):
...

model = init_model(logp)
x = some_state
logp_val = model.logp(x)

class model.Model

Convenience class for building models from log-priors and log-likelihood.

Example:

# Linear regression model
def logp(b, sig):
model = Model()

# Estimate from data and coefficients
y_hat = np.dot(X, b)

# Add log-priors for coefficients and model error

__call__(state)