erdogant / bnlearn

Python library for learning the graphical structure of Bayesian networks, parameter learning, inference and sampling methods.
https://erdogant.github.io/bnlearn
Other
463 stars 45 forks source link

violates the assumptions of the model #52

Closed zh-zhang1984 closed 2 years ago

zh-zhang1984 commented 2 years ago

Dear authors Thanks for the excellent package. I have encounter an "violates the assumptions of the model" issue that cannot be solved. I have a several continuous variable and a mort_flg factor variable; and I create a whitelist:

wl <- expand.grid(
  from = c("SOFA_day_1","SOFA_day_3","lac_day_1","lac_day_3","lac_day_5"), 
  to = "mort_flg",
  stringsAsFactors = FALSE)
dyn.dag = iamb(
+   phenoData_wide, whitelist = wl)
Error in check.arcs.against.assumptions(whitelist, data, criterion) : 
  arc SOFA_day_1 -> mort_flg violates the assumptions of the model.

when I remove SOFA_day_1, it still report errors:

> wl <- expand.grid(
+   from = c("SOFA_day_3","lac_day_1","lac_day_3","lac_day_5"), 
+   to = "mort_flg",
+   stringsAsFactors = FALSE)
> dyn.dag = iamb(
+   phenoData_wide, whitelist = wl)
Error in check.arcs.against.assumptions(whitelist, data, criterion) : 
  arc SOFA_day_3 -> mort_flg violates the assumptions of the model.

It appears continuous variable cannot have causal link to binary variable?

erdogant commented 2 years ago

This is the python version! It looks like you are doing R here ;-)