Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No constraints on the parameters of a sum node #133

Open
AlexandreDubray opened this issue Jun 22, 2023 · 1 comment
Open

No constraints on the parameters of a sum node #133

AlexandreDubray opened this issue Jun 22, 2023 · 1 comment

Comments

@AlexandreDubray
Copy link

Hi,

It seems that there are no constraints on the parameters (log probs for the children) of a sum node. It means that an input (adapted from the doc)

using ProbabilisticCircuits;

X1, X2, X3    = [InputNode(i, Indicator(true))  for i=1:3]
X1_, X2_, X3_ = [InputNode(i, Indicator(false)) for i=1:3]

pc = 1.3 * (X1_ *
             (0.2 * X2_ + 0.8 * X3)) +
     0.7 * (X1 *
             (0.4 * X2 + 0.6 * X3_));

data = Matrix{Union{Missing, Bool}}([missing missing true])
probs = loglikelihoods(pc, data; batch_size=3)
println(exp(first(probs)))

does not raise any error (or warning) and gives a probability of 1.58. Is it allowed by design ? Otherwise, a little check that the weights of the mixture sum up to 1.0 adds almost no overhead at creation time and avoid such situation.

@khosravipasha
Copy link
Contributor

Hi, yes we currently do not enforce constraints when user specifies the circuit manually. This is mostly because we almost always learn both the structure and paramters of the circuit from data which in those cases we do ensure paramters are valid and normalized.

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

No branches or pull requests

2 participants