bnlearn icon indicating copy to clipboard operation
bnlearn copied to clipboard

fit() got an unexpected keyword argument 'evidance'

Open samanemami opened this issue 2 years ago • 8 comments

I am trying to reproduce the Inference example by making DAG with the following method;

model = bn.structure_learning.fit(df, methodtype='hc', scoretype='bic')
DAG = bn.make_DAG(model)
q1 =bn.inference.fit(DAG, variables=['3'], evidance={'1':0})

But I receive the following TypeError

TypeError: fit() got an unexpected keyword argument 'evidance'

I know that it comes from the DAG, but DAG is a dictionary and it is based on the standard of the example in the documentation.

Could you help me with this, please?

samanemami avatar Jul 22 '22 10:07 samanemami

Seems like a typo: try evidence instead of evidance

If this example comes from the from documentation pages, I need to fix the typo.

erdogant avatar Jul 22 '22 12:07 erdogant

Seems like a typo: try evidence instead of evidance

If this example comes from the from documentation pages, I need to fix the typo.

The example of the documentation works perfectly. But when I use structure_learning.fit() method to construct a DAG with make_DAG(), it returns an error in inference(), but if I manually construct the edges in the dictionary, it works fine.

samanemami avatar Jul 22 '22 12:07 samanemami

Ok! I will look at this!

erdogant avatar Jul 22 '22 13:07 erdogant

Ok! I will look at this!

Thank you so much

samanemami avatar Jul 22 '22 14:07 samanemami

I am unable to reproduce the error. Can you show this error with a small example?

erdogant avatar Aug 05 '22 12:08 erdogant

Thank you @erdogant I managed to fix the problem. It was coming from the data frame. I am using uchar8 as the data type for the model input. But I can not make the predict method work. It gives me the following error;

image

samanemami avatar Aug 06 '22 15:08 samanemami

Did you try to update to the latest version? It seems look an issue that may have fixed the other day.

Try first:

pip install -U bnlearn

erdogant avatar Aug 06 '22 17:08 erdogant

It is not working with the last version. If you send me the kaggle user, I can give you access to the problem. Thank you

samanemami avatar Aug 07 '22 16:08 samanemami