Site#

class fedcausal.fedges.Site(data, *, criterion='bdeu', ess=1.0, expected_parents=1.0, penalty_discount=1.0, max_parents=None, max_t_size=None, local_fusion=None, refinement=None, knowledge=None, search='ges')[source]#

A FedGES participant: it learns from its own data and merges in the global model.

Parameters:
dataDiscreteDataset or ContinuousDataset

The site’s data. It never leaves the site.

criterion{“bdeu”, “bic”, “gaussian_bic”}, default=”bdeu”

The scoring criterion; see make_score().

essfloat, default=1.0

Equivalent sample size of the BDeu score.

expected_parentsfloat or None, default=1.0

Structure prior; see FamilyScore.

penalty_discountfloat, default=1.0

Multiplier of the BIC penalty.

max_parentsint or None, default=None

Most parents an Insert may give a node.

max_t_sizeint or None, default=None

Largest conditioning subset tried by an Insert.

local_fusionFusionOperator, optional

Fuses the site’s model with the global one. The consensus union by default.

refinement{“forward”, “backward”, “both”} or None, default=None

What to do after fusing. None keeps the fused model. The others start again from the site’s own model and let GES’s forward phase add the edges the fused model brought in, the backward phase remove the ones it dropped, or both, wherever that improves the local score.

knowledgeKnowledge, optional

Adjacencies every model must have or must not have. The search keeps to them, and they are imposed again after each fusion.

search{“ges”, “xges0”, “xges”}, default=”ges”

What learn() runs: GES, XGES-0, or XGES with its forced deletions; see XGES. Refinement always uses GES’s phases, restricted to the edges the fusion changed.

Attributes:
modelBNModel or None

The site’s current structure and its local score.

property score#

FamilyScore: The site’s score, kept across rounds for its cache.

learn()[source]#

Run the search from the current model (or the empty graph) and keep the result.

merge(global_dag)[source]#

Fuse global_dag into the current model, refine, and keep the result.

Raises:
RuntimeError

If the site has not learned a model yet.