FittableModel#

jeanspy.model.FittableModel

See methods and properties for individual lookup pages, or the alphabetical API dictionary to search all classes. The full class contract and existing member anchors are retained below.

class jeanspy.model.FittableModel(args_load_data=None, kwargs_load_data=None, *args, **kwargs)#

Bases: jeanspy.model.Model

Subclassing interface for stateful likelihoods and prior terms.

Parameters:
  • args_load_data (list) – Positional arguments forwarded to the concrete load_data method.

  • kwargs_load_data (dict or None, optional) – Keyword arguments forwarded to load_data; None means an empty mapping.

  • *args – Model component and physical parameter initialization arguments.

  • **kwargs – Model component and physical parameter initialization arguments.

Raises:
  • TypeError – The data-loading arguments have the wrong container types, or an abstract subclass has not implemented the required interface.

  • AttributeError – The initialized concrete model does not declare prior_names.

Notes

Concrete subclasses define observation shapes and units, sampling-vector order, conversion to physical parameters, and likelihood/prior terms. Calling a target method updates the stateful components. lnposterior returns the total log posterior followed by log likelihood and individual log priors for emcee blobs. WBIC requires more than one observation.

This NumPy/SciPy host interface does not support physical-parameter JAX tracing. See SphericalDSphEstimationModel for the spherical kinematic target and examples/docs_inference.py for a complete short storage example.

property blobs_dtype#

Return emcee blob fields for log likelihood and individual log priors.

The list contains (name, float) pairs in the same order as the values returned by lnposterior after its first element.

abstractmethod convert_params(p)[source]#

Map a sampling-coordinate vector p to named physical parameters.

Subclasses define vector order, transforms and units. This abstract interface raises NotImplementedError.

property inverse_temperature#

Return the WBIC inverse temperature 1/log(N_data).

is_required_param_names(param_names_candidates)#

Test a sequence of names against this component’s required parameters.

Returns a list of bool with the same length and order as param_names_candidates. Submodel requirements are not included.

lnlikelihood(p, *args, **kwargs)[source]#

Evaluate the explicit kinematic inference target.

Notes

Inputs and units. p is one parameter vector of shape (ndim,) in p_names_lnprob order. Uses already loaded observations.

Returns and shape. Scalar sum of log likelihoods.

lnlikelihoods(p, *args, **kwargs)[source]#

Evaluate the explicit kinematic inference target.

Notes

Inputs and units. p is one parameter vector of shape (ndim,) in p_names_lnprob order. Uses already loaded observations.

Returns and shape. Per-star log densities, shape (N,).

lnposterior(p, *args, **kwargs)[source]#

Evaluate the explicit kinematic inference target.

Notes

Inputs and units. p is one parameter vector of shape (ndim,) in p_names_lnprob order. Uses already loaded observations.

Returns and shape. Tuple (logposterior, loglikelihood, individual prior terms) for emcee blobs.

lnposterior_wbic(p, *args, **kwargs)[source]#

Evaluate the explicit kinematic inference target.

Notes

Inputs and units. p is one parameter vector of shape (ndim,) in p_names_lnprob order. Uses already loaded observations.

Returns and shape. Tuple using loglikelihood/log(N) plus the original prior; requires N>1.

lnpriors(p, *args, **kwargs)[source]#

Evaluate the explicit kinematic inference target.

Notes

Inputs and units. p is one parameter vector of shape (ndim,) in p_names_lnprob order. Uses already loaded observations.

Returns and shape. Sequence of log prior contributions in prior_names order.

abstractmethod load_data(*args, **kwargs)[source]#

Load observations in a concrete estimation model.

Subclasses define the accepted arguments and validation. This abstract interface raises NotImplementedError.

property ndim#

Number of flattened physical parameters, cached on first access.

property params_all#

Return a flattened Parameters copy of this model and its submodels.

Values retain their physical units. Later submodels overwrite duplicate names; use params_all_with_model_name to retain role-qualified names.

property params_all_with_model_name#

Return a new Parameters mapping with submodel-role prefixes.

Nested names use role:parameter notation. Values retain their physical units; this operation copies the mapping, not nested mutable values.

property required_param_names_combined#

Return this model’s and all nested submodels’ required parameter names.

The result is a list in traversal order; duplicate names are retained.

sampling_identity(sampled_names=())#

Configuration and fixed parameters, excluding changing MCMC coordinates.

update(new_params=None, **kwargs)#

Replace named parameters in the owning components.

Notes

Inputs and units. new_params is an optional mapping/Parameters/Series; keyword values are additional replacements. Names are physical names declared by this model and its components. Unknown names raise ValueError before any parameters are changed.

Returns and shape. None; mutates component parameters. params_all returns the resulting flattened copy.