Skip to main content

Crate radiate_pgm

Crate radiate_pgm 

Source

Structs§

CptKernel
CPT kernel: builds P(child | parents…) as a discrete table with scope [parents…, child] Params are logits in row-major over that scope.
DiscreteFactor
FactorGene
IsingKernel
Ising pairwise kernel over two binary vars: scope [a,b], card 2 each. Params: [h_a0, h_a1, h_b0, h_b1, J_same, J_diff] (simple template)
PgmChromosome
PgmCodec
PgmDataSet
PgmLogLik
PgmNll
PgmParamMutator
PgmScopeMutator
Mutate factor scopes (structure) and rebuild their tables.
VarId
VarSpec

Enums§

FactorKind

Traits§

FactorKernel

Functions§

chromosome_factors
Convert a chromosome into math factors.
clamp_f32
gene_to_discrete
Convert a single FactorGene into a DiscreteFactor using the chromosome’s vars table.
joint_factor
Multiply all chromosome factors into a single joint factor. This is exact but can be huge; intended for small models / debugging.
log_normalize_in_place
log-space normalize a slice in-place so that exp(slice).sum() == 1.
loglik_evidence
Evidence log-likelihood for a row with missing values. This returns log( sum_{hidden} exp( sum_f logphi_f(x) ) ). For a normalized model, subtract logZ to get log P(evidence).
logp_evidence
Convenience: log P(evidence) under a normalized model.
logsumexp
logz
Compute logZ (log-partition) by eliminating all variables.
marginal_joint
Compute a marginal over keep variables by building the joint and marginalizing out others.
marginal_ve
Compute a marginal using variable elimination (preferred). elim_order is used as-is; if None, it defaults to eliminating all vars not in keep in id order.
neg_mean_loglik
Convenience: negative mean log-likelihood over a dataset.
prod_usize
variable_elimination
A very small discrete-only VE evaluator: