Internal Documentation
Documentation for DistributionsInference's internal interface.
Contents
Index
Internal API
DistributionsInference._concrete_field_candidates Function
_concrete_field_candidates(
objtype,
rows
) -> Vector{Tuple{Int64, Symbol, DataType}}The estimated rows whose own struct field is concretely typed, precomputed once.
_concrete_field_candidates(objtype, rows) walks the estimated rows distribution_to_logdensity already derived at construction and keeps the (index, name, declared_type) triples the concrete-field-under-AD guard (#48) must check: index into the estimated flat vector, name the row's own struct field, declared_type that field's concrete type. A row with a dotted name (a nested structure this generic check does not introspect) or a non-concrete declared type is dropped, so a properly generic object gets an empty list and logdensity's per-evaluation guard is a single isempty check.
DistributionsInference._to_flexichain Function
_to_flexichain(
obj,
draws
) -> FlexiChains.SymChain{FlexiChains.FlexiChainMetadata{DimensionalData.Dimensions.Lookups.Sampled{Int64, UnitRange{Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Int64}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}, DimensionalData.Dimensions.Lookups.Sampled{Int64, UnitRange{Int64}, DimensionalData.Dimensions.Lookups.ForwardOrdered, DimensionalData.Dimensions.Lookups.Regular{Int64}, DimensionalData.Dimensions.Lookups.Points, DimensionalData.Dimensions.Lookups.NoMetadata}, Vector{Missing}, Vector{Missing}}}Build a dotted-name FlexiChain from raw sampler draws. Internal.
_to_flexichain(obj, draws) keys draws by estimated_rows(obj)'s dotted names (in parameter_rows order), so the result reads back onto obj with point_estimate/distribution_draws. draws is accepted in either raw shape a LogDensityProblems-compatible sampler hands back: a dim x niter matrix, or a niter-length vector of dim-length vectors, where dim is flat_dimension(obj). An object estimating nothing (dim == 0) still needs draws to carry the draw count — pass a (0, niter) matrix or a niter-length vector of empty vectors.
Not part of the public surface: standardising a sampler's raw draws into a chain type belongs to FlexiChains or to the inference package that produced them, not here (#91 takes the conversion off the readback path entirely). It stays as the internal entry point from a bare LogDensityProblems sampler's draws, which is the one route into the readback with no chain of its own, until #91 settles where that conversion lives.
This has no method until FlexiChains is loaded; the chain construction lives in the DistributionsInferenceFlexiChainsExt extension.
Arguments
obj: the fittable object the draws were sampled for.draws: the raw draws,dim x niteror aniter-vector ofdim-vectors.
See also
point_estimate: reduce a chain back ontoobj(point summary/draw).distribution_draws: the vectorised, every-draw form.