Skip to content

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

@fritzo

Description

@fritzo

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions