Comments (6)
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). :)
from pybn.
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.
from pybn.
from pybn.
Hi Nicholas,
I tried with modified csv with asia.bif . Then also I am facing the same issue.
I got this error -
python test.py
['asia', 'smoke', 'tub', 'bronc', 'lung', 'either', 'dysp', 'xray']
('asia', 'tub')
('smoke', 'bronc')
('smoke', 'lung')
('tub', 'either')
('bronc', 'dysp')
('lung', 'either')
('either', 'dysp')
('either', 'xray')
/home/sonu/Documents/pyBN/pyBN-master/pyBN/learning/parameter/mle.py:48: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
F[rv]['cpt'] = nmp.histogram(data[:,rv], bins=bn.card(rv))[0]
Traceback (most recent call last):
File "test.py", line 20, 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 48, in mle_fast
F[rv]['cpt'] = nmp.histogram(data[:,rv], bins=bn.card(rv))[0]
IndexError: only integers, slices (:
), ellipsis (...
), numpy.newaxis (None
) and integer or boolean arrays are valid indices
Please help me.
Regards
asia.bif.zip
Sonu
lizards.csv.zip
from pybn.
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.
from pybn.
Pull the repository and try again
from pybn.
Related Issues (20)
- parameter learning HOT 1
- clean up data HOT 1
- remove networkx dependencies HOT 1
- major bn.data design change HOT 3
- helper class functions
- Plotting Issues HOT 1
- Clique Tree & Cluster Graph Issues HOT 1
- parameter learning not giving correct values HOT 1
- variable elimination not giving correct answers with evidence HOT 2
- Chow Liu Tree code wrong
- Newer versions of numpy (>= 1.12.0) does not accept float as array index
- hill_climbing
- MLE Estimator
- topsort() is wrong
- Installing the software
- ModuleNotFoundError: No module named 'pyBN.structure_learn'
- unable to install pyBN
- write tests for everything HOT 1
- model merging
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pybn.