Skip to content
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

ValueError: math domain error #3

Open
ukamath opened this issue Dec 17, 2020 · 1 comment
Open

ValueError: math domain error #3

ukamath opened this issue Dec 17, 2020 · 1 comment

Comments

@ukamath
Copy link

ukamath commented Dec 17, 2020

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

@ShiZihao-sudo
Copy link

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*(p1_np.log(p1)+(1-p1)np.log(1-p1))-(1-pp)(p2_np.log(p2)+(1-p2)np.log(1-p2)) /Users/uday.kamath/BOA/BOAmodel.py:110: RuntimeWarning: invalid value encountered in multiply cond_entropy = -pp(p1_np.log(p1)+(1-p1)np.log(1-p1))-(1-pp)(p2_np.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)(p2_np.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)(p2_np.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*(p1_np.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

Did you solve this problem? I'm also having this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants