Hi Lars, thanks for the kind words :-) I am trying to reproduce your bug.
For now, the code
import pyAgrum as gum gum.about() bn=gum.fastBN("A->B<-C->D->A") bn.saveBIF("one.bif") bn2=gum.loadBN("one.bif") bn2.saveDSL("two.dsl") bn3=gum.loadBN("two.dsl") bn3.saveNET("three.net") bn4=gum.loadBN("three.net") if bn==bn2: print("ok2") if bn==bn3: print("ok3") if bn==bn4: print("ok4") bn5=gum.fastBN("A->B->C->D") if bn==bn5: print("not ok5") else: print("ok5")
works on linux and anaconda macOS64 ... I am updating anaconda on a windows computer before trying it
This is a move that we planned long time ago already. LGPL does not change anything for current users. We do it now because LGPL is considered by several contacts as an advantage in order to choose aGrUM/pyAgrum (more precisely : GPL seen as a drawback).
Hi Francisco, thanks for the kind words! We do not deal with continuous variables for now in aGrUM... mainly because we do not feel very confident in the existing models (like CLG, etc.) for Continuous graphical models. We are working on different extensions or collaborations with other libraries to provide a good way t o deal with continuous variable in graphical models.
For now, you can of course learn quasi-continuous BN from continuous data (see above)
First, before analyzing and using your BN, I suggest you either to wait for the new tag "0.15.3" (during this week hopefully) or (if you use
pip to download pyAgrum) to install
pyAgrum-nightly : I found a nasty bug in the Parameter learning algorithm when at least one configuration of the parents of a node is not found in the database. It is fixed in the master of our gitlab site but not deployed. So the results you have for now may be erroneous (in term of learned parameters). If you prefer, a quick workaround should be to add a small prior (Laplace adjustment) with :
learner.useAprioriSmoothing(1e-5) which guarantees that no parents configuration is unknown.
Second, for your choice of discretization, this is exactly the reason why we do not do it ourself :-) the correct discretiezation is directly related to the base and the user.
Concerning the impact of the granularity, I do not know any theory on that kind but it is quite well known that indepency test (such as chi2) and scores are not very robust w.r.t this granularity.
You may try the learning algorithm based on mutual information instead of scores or chi2 in aGrUM : miic (
learner.useMIIC()) which should be a bit more robust.
However, it is important to note also that a high granularity (with many values for the discrete variable) will need much more data for the learning phase (structure and parameters).
learner.useAprioriSmoothing(1e-5)with some results 'apparently better', thanks again !!