Giter Site home page Giter Site logo

BDe score about pybn HOT 6 CLOSED

ncullen93 avatar ncullen93 commented on August 30, 2024
BDe score

from pybn.

Comments (6)

ncullen93 avatar ncullen93 commented on August 30, 2024

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.

ncullen93 avatar ncullen93 commented on August 30, 2024

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.

sonujose123 avatar sonujose123 commented on August 30, 2024

from pybn.

sonujose123 avatar sonujose123 commented on August 30, 2024

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.

ncullen93 avatar ncullen93 commented on August 30, 2024

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.

ncullen93 avatar ncullen93 commented on August 30, 2024

Pull the repository and try again

from pybn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.