HierarchicalBayesianRegression
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 priorConstructors
HierarchicalBayesianRegression
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.
link
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
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.