.. _model: 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. :ref:`Model ` expects separate log P(X) and gradient functions. :ref:`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) grad_val = model.grad(x) logp_val, grad_val = model(x) .. _model_class: .. module:: model .. autofunction:: init_model .. autoclass:: Model :members: :inherited-members: .. method:: __call__(state) Return log P(X) and grad log P(X) given a :ref:`state ` X .. _single_model_class: .. autoclass:: SingleModel :members: :inherited-members: .. method:: __call__(state) Return log P(X) and grad log P(X) given a :ref:`state ` X