bayes_logistic
bayes_logistic copied to clipboard
AttributeError: 'float' object has no attribute 'exp'
Hit the following exception
/usr/local/lib/python2.7/dist-packages/bayes_logistic/bayes_logistic.py in logistic_prob(X, w) 62 63 # calculate logitstic probability ---> 64 pr = np.exp(z) 65 66 pr = pr / (1. + pr)
AttributeError: 'float' object has no attribute 'exp'
Following is the URL of the notebook that reproduces the error http://pastebin.com/EMWLqjF1
I have the fix for the issue, so will open a PR for it.
The error here is occurring because the y array in the notebook in #6 is coming from pandas as an object dtype. If you cast that to an int (y = y.astype(int)) or a bool (y = y.astype(bool)) then things will behave as expected.
Yes, that seems to fix the Exception.
However without the change in PR #8 , the prediction accuracy of the model seems to change for every run (for the parkinson's notebook), which is weird and I don't understand yet.
Also I have update PR #6 with the suggested change
I have updated PR #8 to check for the data type of y.