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

Error in Naive Bayes Classification section #557

Open
robertjankowski opened this issue Dec 18, 2018 · 0 comments
Open

Error in Naive Bayes Classification section #557

robertjankowski opened this issue Dec 18, 2018 · 0 comments

Comments

@robertjankowski
Copy link

While learning about Naive Bayes Classification I encountered a problem with bayespost function. When I rewrited this function in my jupyter notebook I got following error

AssertionError: Argument data must have NDArray type, but got ...

I wanted to fix this and change two lines in this function

def bayespost(data):
    logpost = logpy.copy()
    logpost += (logpx * x + logpxneg * (1 - x)).sum(0)
    logpost -= nd.max(logpost)
    post = nd.exp(logpost)  # before was:  post = nd.exp(logpost).asnumpy()
    post /= nd.sum(post)
    return post.asnumpy() # before was:  post

I am also curious if only I got this error

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

1 participant