Skip to content

Conversation

@ZJsheep
Copy link

@ZJsheep ZJsheep commented Dec 16, 2025

According to the Bernoulli edge-based structure prior combined with the BDeu marginal likelihood, the structure prior can be written as

$$ \log p(G) = \sum_{i=1}^{d} \left[ |PA_i| \log\left(\frac{\kappa}{d-1}\right) + (d - 1 - |PA_i|)\log\left(1 - \frac{\kappa}{d-1}\right) \right], $$

where $d$ denotes the number of variables (features), since each node can have at most $d-1$ possible parents.

In the original implementation, however, the Data array has shape (number_of_samples, number_of_variables). Therefore, Data.shape[1] should be used instead of Data.shape[0] when computing the structure prior.

Fix calculation of vm to use the number of columns (number of variables) instead of rows (number of samples).

Signed-off-by: Zhou Jiayang <73184640+ZJsheep@users.noreply.github.com>
@ZJsheep ZJsheep changed the title Fix implementation of the structure score term of the BDeu score Fix implementation of the structure prior term of the BDeu score Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant