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

[WIP] Add method for Dirichlet Processes #1761

Closed
wants to merge 4 commits into from
Closed

[WIP] Add method for Dirichlet Processes #1761

wants to merge 4 commits into from

Conversation

souravsingh
Copy link
Contributor

This is related to project for implementing non-parameteric Bayesian processes.

I may have made a mistake in writing the method.

@twiecki

@AustinRochford
Copy link
Member

@souravsingh I'll write out some feedback and pointers for implementing this today or tomorrow.

@souravsingh
Copy link
Contributor Author

@AustinRochford Can you give some feedback on the PR? I would love to have this feature merged into PyMC3.

@AustinRochford
Copy link
Member

Apologies, work got more hectic than I thought, will try to give some feedback to get you unblocked tonight.

@AustinRochford
Copy link
Member

@souravsingh there are two distributions we should eventually build here, and we should decide which one to attack first.

  1. The (truncated) Dirichlet process, which is a discrete distribution. The implementation may be simpler, but efficient sampling is a bit more complex.
  2. The (truncated) Dirichlet process mixture model. pymc3's Mixture class is useful here.

Let me know which one you want to attack first and we can work on a PR.

@souravsingh
Copy link
Contributor Author

@AustinRochford I would like to start with Dirichlet process.

@AustinRochford
Copy link
Member

Great.

This is a bit complex, since we need to store both the weights and atoms as two separate RVs. I think the place to start would be implementing a (truncated) stick breaking process distribution by filling in something similar to this class definition:

from pymc3.distributions import Continuous

class StickBreakingProcess(Continuous):
    def __init__(self, alpha, shape=None, *args, **kwargs):
        super(StickBreaking, self).__init__(*args, shape=shape, **kwargs)
        
        raise NotImplementedError
        
    def logp(self, value):
        raise NotImplementedError

I'm thinking the shape argument can tell us how many components to truncate at.

@twiecki what do you think the best way to use such a class in combination with an RV producing atoms would be to implement a Dirichlet process so that we can still record the values of the weights in the trace?

@souravsingh
Copy link
Contributor Author

@twiecki I need some help with the PR.

@twiecki
Copy link
Member

twiecki commented Feb 22, 2017

@AustinRochford I'm not sure I understand completely, but an easy solution seems to be to just set all atoms that are unused to 0 and always record the full shape in the trace?

@souravsingh
Copy link
Contributor Author

@AustinRochford I will close the PR and make a new PR will updated changes again.

@souravsingh souravsingh deleted the add-method branch February 27, 2017 23:28
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

Successfully merging this pull request may close these issues.

None yet

3 participants