kumulant

HierarchicalBayesianRegression

class HierarchicalBayesianRegression(val featureSize: Int, val link: Link = Link.Identity, val biasPriorVariance: Double = 1.0, val concurrency: Concurrency = Concurrency.None, initialPriorVariance: Double = 1.0, initialPriorMean: DenseVector? = null, initialPriorCovariance: DenseMatrix? = null)(source)

Manager for a population of BayesianRegressionStat instances that share an empirical-Bayes prior. New instances inherit the current populationPrior; periodic refit re-fits the prior from the current per-instance posteriors. Cross-instance transfer happens through that prior; older instances keep accumulating their own state, but freshly created instances borrow from the population's collective experience.

Not thread-safe: callers should serialise createInstance / untrack / refit externally if used concurrently. Individual instances inherit the concurrency level chosen here for their own update path.

Typical lifecycle:

val pop = HierarchicalBayesianRegression(featureSize = 8)
val instanceA = pop.createInstance()  // seeded from initial isotropic prior
// ... feed observations to instanceA ...
val instanceB = pop.createInstance()  // still using initial prior
pop.refit()                           // population prior now reflects instanceA's evidence
val instanceC = pop.createInstance()  // benefits from instanceA's data via prior

Constructors

HierarchicalBayesianRegression

constructor(featureSize: Int, link: Link = Link.Identity, biasPriorVariance: Double = 1.0, concurrency: Concurrency = Concurrency.None, initialPriorVariance: Double = 1.0, initialPriorMean: DenseVector? = null, initialPriorCovariance: DenseMatrix? = null)(source)

Properties

biasPriorVariance

Bias prior variance forwarded to each instance's constructor; not refitted.

concurrency

Concurrency level forwarded to each instance.

featureSize

Feature dimensionality of every managed instance.

instanceCount

Number of instances currently contributing to refit.

populationPrior

Population prior used to seed new instances. Initially isotropic (N(0, initialPriorVariance * I)) or seeded from caller-supplied mean/covariance; call refit to update it from the current per-instance posteriors.

Functions

createInstance

Allocate a fresh BayesianRegressionStat seeded with the current populationPrior.

refit

fun refit()(source)

Refit populationPrior from the current per-instance posteriors. No-op if no instances are tracked. Existing instances keep their state; only future createInstance calls see the updated prior.

untrack

Remove instance from population tracking. Future refit calls will not see its posterior. Useful when an instance is retired or its data has gone stale.