Score#
- class causalbase.scores.Score(*args, **kwargs)[source]#
A decomposable score: a DAG scores the sum of its families’ local scores.
This is what
causalbase.search.ges()andcausalbase.search.xges()need from a score, and the extension point for new ones. Any object with ann_varsattribute (the number of variables, which sets the size of the graph a search learns) and these two methods works with them; the other searches also calllocal_scores_add(node, parents, candidates). The easiest way to write a score is to subclassFamilyScoreand implement itscompute_family, which adds caching, batching, the structure prior andlocal_scores_add, so the score works with every search.Higher is better, and both methods must give the same value for the same family: the search compares their results directly.
- local_scores_with(node, parents, extra)[source]#
Return the local score of node given
parents | {x}, for each x in extra.The families an Insert compares, all at once; a loop over
local_score()is a correct implementation.