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)<br>val instanceA = pop.createInstance() // seeded from initial isotropic prior<br>// ... feed observations to instanceA ...<br>val instanceB = pop.createInstance() // still using initial prior<br>pop.refit() // population prior now reflects instanceA's evidence<br>val instanceC = pop.createInstance() // benefits from instanceA's data via priorConstructors
Properties
Bias prior variance forwarded to each instance's constructor; not refitted.
Concurrency level forwarded to each instance.
Feature dimensionality of every managed instance.
Number of instances currently contributing to refit.
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
Allocate a fresh BayesianRegressionStat seeded with the current populationPrior.
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.
HierarchicalBayesianRegression
biasPriorVariance
Bias prior variance forwarded to each instance's constructor; not refitted.
concurrency
Concurrency level forwarded to each instance.
createInstance
Allocate a fresh BayesianRegressionStat seeded with the current populationPrior.
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.
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.