BaseStructureScore#
- class pgmpy.structure_score.BaseStructureScore(data, state_names=None)[source]#
Bases:
BaseObjectAbstract base class for structure scoring in pgmpy.
Structure scores evaluate how well a candidate Bayesian network structure fits observed data. This class implements the shared scoring workflow, caching for local scores, and utilities for computing conditional state counts. Use one of the concrete score classes such as K2, BDeu, BIC, or AIC instead of instantiating this class directly.
- Parameters:
- datapandas.DataFrame
DataFrame in which each column represents a variable. Missing values should be marked as numpy.nan.
- state_namesdict, optional
Dictionary mapping each variable name to its allowed states. If not specified, the observed values in the data are used.
- local_score(variable: str, parents: tuple[str, ...]) float[source]#
Compute the cached local score for variable given parents.