GaussianBICScore#

class causalbase.scores.GaussianBICScore(data, *, penalty_discount=1.0, expected_parents=1.0, n_jobs=1)[source]#

BIC local score of a linear Gaussian model, memoised per family.

The maximised log likelihood of regressing a node on its parents, -n/2 * (log(2 pi s2) + 1) with s2 the residual variance, less penalty_discount * log(n) / 2 per parameter (a coefficient per parent, the intercept and the variance), plus the structure prior of FamilyScore. It needs only the number of rows and the covariance matrix, computed once. A parent that is a linear combination of the others explains nothing more and costs only its penalty; the residual variance is floored at 1e-12 times the variable’s own, so a deterministic family scores very well instead of infinitely well.

Parameters:
dataContinuousDataset

The data to score against.

penalty_discountfloat, default=1.0

Multiplies the penalty; larger values give sparser structures.

expected_parentsfloat or None, default=1.0

Expected number of parents per node under the structure prior, as in BDeuScore. None is the plain BIC.

n_jobsint, default=1

Threads of the exact search’s compiled kernels; -1 is every thread numba has. Results do not depend on it.

Raises:
ValueError

If penalty_discount is not positive and finite, expected_parents is not positive, or n_jobs is neither a positive integer nor -1.

Notes

Not safe to share between threads, since it caches every family it computes; use one score per thread.