-
Notifications
You must be signed in to change notification settings - Fork 55
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
BDe score #20
Comments
I think this is because the network and the data don't match.. The andes network has these nodes: ['asia', 'smoke', 'tub', 'bronc', 'lung', 'either', 'dysp', 'xray'], whereas the lizards dataset only has 3 columns (nodes).. The BDe score measures how well a given BN fits a COMPATIBLE dataset (i.e. the nodes of the BN match up with the columns of the dataset). :) |
Note, you can try LEARNING the structure from the lizards.csv dataset and check the BDe score.. OR you can generate your own random andes dataset and check the BDe score. |
Thanks a lot for your quick response.
…On Dec 4, 2016 8:43 PM, "Nicholas Cullen" ***@***.***> wrote:
Note, you can try LEARNING the structure from the lizards.csv dataset and
check the BDe score.. OR you can generate your own random andes dataset and
check the BDe score.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#20 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQjW7cACYYtAtT-aHoMcVKIBMBtBEL6yks5rE5aPgaJpZM4LD0wr>
.
|
Hi Nicholas, Please help me. Regards Sonu |
Ok i think i fixed it... pandas must have changed their indexing since I wrote this. It should work if 'data' is a pandas dataframe whose columns are same as BN nodes.. but i think it will now be broken if data is numpy array. |
Pull the repository and try again |
I created BN from a BIF file (asia.bif) . But when I try to find the score using BDe with 'lizards.csv' it is failing.
Code -
from pyBN import *
import numpy as np
import os
from os.path import dirname
file = 'data/asia.bif'
bn = read_bn(file)
dpath = os.path.join(dirname(dirname(dirname(dirname(file)))),'data')
path = (os.path.join(dpath,'lizards.csv'))
data = np.loadtxt(path, dtype='int32',skiprows=1,delimiter=',')
print BDe(bn,data)
Error
Traceback (most recent call last):
File "test.py", line 12, in
print BDe(bn,data)
File "/home/sonu/Documents/pyBN/pyBN-master/pyBN/learning/structure/score/bayes_scores.py", line 61, in BDe
counts_dict = mle_fast(bn, data, counts=True, np=True)
File "/home/sonu/Documents/pyBN/pyBN-master/pyBN/learning/parameter/mle.py", line 41, in mle_fast
F[n]['values'] = list(nmp.unique(data[:,i]))
IndexError: index 3 is out of bounds for axis 1 with size 3
The text was updated successfully, but these errors were encountered: