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

Implement exact multinomial math in server.logprob() etc. #13

Open
fritzo opened this issue Jul 11, 2017 · 0 comments
Open

Implement exact multinomial math in server.logprob() etc. #13

fritzo opened this issue Jul 11, 2017 · 0 comments

Comments

@fritzo
Copy link
Member

fritzo commented Jul 11, 2017

The current implementation of data conditioning in the server uses a "with-replacement approximation" of the likelihood function, i.e. it uses pow() instead of gamma() or factorial(). This design decision was based on an early non-vectorized implementation, where calling gamma() was very slow; however the server is now vectorized, so it should be cheap to implement exact likelihood computations.

How?

For math details, see Stephen Tu's excellent writeup or Wikipedia.

Where?

This approximation is pervasive in serving.py, simply search for "with-replacement":

Performance Impact

Results from treecat.profile serve show that the majority of time is spent on np.dot() in propagation. Therefore there should be negligible cost in switching from np.pow to scipy.special.gammaln.

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

No branches or pull requests

1 participant