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

AttributeError: 'float' object has no attribute 'exp' #7

Open
vishpat opened this issue Feb 12, 2017 · 5 comments
Open

AttributeError: 'float' object has no attribute 'exp' #7

vishpat opened this issue Feb 12, 2017 · 5 comments

Comments

@vishpat
Copy link

vishpat commented Feb 12, 2017

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

@vishpat
Copy link
Author

vishpat commented Feb 12, 2017

I have the fix for the issue, so will open a PR for it.

@ericdill
Copy link

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.

@vishpat
Copy link
Author

vishpat commented Feb 13, 2017

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.

@vishpat
Copy link
Author

vishpat commented Feb 13, 2017

Also I have update PR #6 with the suggested change

@vishpat
Copy link
Author

vishpat commented Feb 13, 2017

I have updated PR #8 to check for the data type of y.

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