wangtongada / boa Goto Github PK
View Code? Open in Web Editor NEWBayesian or-of-and
License: MIT License
Bayesian or-of-and
License: MIT License
Cloning and running 'python example.py' yields:
/BOA/BOAmodel.py:127: RuntimeWarning: divide by zero encountered in log.
What can be done?
Running with discretized diabetes dataset now get this error
weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
from numpy.core.umath_tests import inner1d
Took 9.271s to generate 28063 rules
Screening rules using information gain
/Users/uday.kamath/BOA/BOAmodel.py:110: RuntimeWarning: divide by zero encountered in log
cond_entropy = -pp*(p1np.log(p1)+(1-p1)np.log(1-p1))-(1-pp)(p2np.log(p2)+(1-p2)np.log(1-p2))
/Users/uday.kamath/BOA/BOAmodel.py:110: RuntimeWarning: invalid value encountered in multiply
cond_entropy = -pp(p1np.log(p1)+(1-p1)np.log(1-p1))-(1-pp)(p2np.log(p2)+(1-p2)np.log(1-p2))
/Users/uday.kamath/BOA/BOAmodel.py:111: RuntimeWarning: divide by zero encountered in log
cond_entropy[p1(1-p1)==0] = -((1-pp)(p2np.log(p2)+(1-p2)np.log(1-p2)))[p1(1-p1)==0]
/Users/uday.kamath/BOA/BOAmodel.py:111: RuntimeWarning: invalid value encountered in multiply
cond_entropy[p1*(1-p1)==0] = -((1-pp)(p2np.log(p2)+(1-p2)np.log(1-p2)))[p1(1-p1)==0]
/Users/uday.kamath/BOA/BOAmodel.py:112: RuntimeWarning: divide by zero encountered in log
cond_entropy[p2*(1-p2)==0] = -(pp*(p1np.log(p1)+(1-p1)np.log(1-p1)))[p2(1-p2)==0]
/Users/uday.kamath/BOA/BOAmodel.py:112: RuntimeWarning: invalid value encountered in multiply
cond_entropy[p2(1-p2)==0] = -(pp*(p1*np.log(p1)+(1-p1)np.log(1-p1)))[p2(1-p2)==0]
Took 1.552s to generate 2000 rules
Computing sizes for pattern space ...
Took 0.000s to compute patternspace
No or wrong input for alpha_l and beta_l. The model will use default parameters!
alpha = 10, beta = 0.0
Traceback (most recent call last):
File "./diabetes.py", line 39, in
rules = model.SA_patternbased(Niteration,Nchain,print_message=True)
File "/Users/uday.kamath/BOA/BOAmodel.py", line 163, in SA_patternbased
cfmatrix,prob = self.compute_prob(rules_new)
File "/Users/uday.kamath/BOA/BOAmodel.py", line 269, in compute_prob
prior_ChsRules= sum([log_betabin(Kn_count[i],self.patternSpace[i],self.alpha_l[i],self.beta_l[i]) for i in range(1,len(Kn_count),1)])
File "/Users/uday.kamath/BOA/BOAmodel.py", line 269, in
prior_ChsRules= sum([log_betabin(Kn_count[i],self.patternSpace[i],self.alpha_l[i],self.beta_l[i]) for i in range(1,len(Kn_count),1)])
File "/Users/uday.kamath/BOA/BOAmodel.py", line 347, in log_betabin
return math.lgamma(k+alpha) + math.lgamma(n-k+beta) - math.lgamma(n+alpha+beta) + Const
ValueError: math domain error
diabetes-Y.txt
diabetes-X.txt
uday:BOA uday.kamath$ python ./example.py
/Users/uday.kamath/anaconda/lib/python3.6/site-packages/sklearn/ensemble/weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
from numpy.core.umath_tests import inner1d
Took 8.330s to generate 18860 rules
Screening rules using information gain
/Users/uday.kamath/BOA/BOAmodel.py:110: RuntimeWarning: divide by zero encountered in log
cond_entropy = -pp*(p1np.log(p1)+(1-p1)np.log(1-p1))-(1-pp)(p2np.log(p2)+(1-p2)np.log(1-p2))
/Users/uday.kamath/BOA/BOAmodel.py:110: RuntimeWarning: invalid value encountered in multiply
cond_entropy = -pp(p1np.log(p1)+(1-p1)np.log(1-p1))-(1-pp)(p2np.log(p2)+(1-p2)np.log(1-p2))
/Users/uday.kamath/BOA/BOAmodel.py:112: RuntimeWarning: divide by zero encountered in log
cond_entropy[p2(1-p2)==0] = -(pp*(p1np.log(p1)+(1-p1)np.log(1-p1)))[p2(1-p2)==0]
/Users/uday.kamath/BOA/BOAmodel.py:112: RuntimeWarning: invalid value encountered in multiply
cond_entropy[p2(1-p2)==0] = -(pp*(p1*np.log(p1)+(1-p1)np.log(1-p1)))[p2(1-p2)==0]
Took 1.395s to generate 2000 rules
Computing sizes for pattern space ...
Took 0.001s to compute patternspace
No or wrong input for alpha_l and beta_l. The model will use default parameters!
Traceback (most recent call last):
File "./example.py", line 39, in
rules = model.SA_patternbased(Niteration,Nchain,print_message=True)
File "/Users/uday.kamath/BOA/BOAmodel.py", line 162, in SA_patternbased
rules_new, rules_norm = self.propose(rules_curr.copy(), rules_curr_norm.copy(),q)
File "/Users/uday.kamath/BOA/BOAmodel.py", line 193, in propose
ex = sample(incorr,1)[0]
File "/Users/uday.kamath/anaconda/lib/python3.6/random.py", line 313, in sample
raise TypeError("Population must be a sequence or set. For dicts, use list(d).")
Hi ๐ thanks for this wonderful work and code release!
We (in the Bin Yu group at UC Berkeley) have been working on a package for fitting rule-based models and have been wanting to add BOA for a while!
I've just started to integrate it in (file here or doc here). Hopefully this common interface can help make BOA very easily accessible to a large audience ๐ The readme links back to this repo too.
Please let me know if you have any issues with this or want to make any tweaks to the implementation there!
Thanks,
Chandan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.