-
Notifications
You must be signed in to change notification settings - Fork 62
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
Model vs. Distribution solution #25
Comments
In this code a Model means something with extensive latent variables (in addition to intensive latent variables). That is, a Model has a latent variable for each data point, hence it needs an That's how it is now, but maybe something else would be better. I think you're suggesting that Distributions should also have an If that's the case, we could probably accomplish that with a mixin like this one (untested, probably doesn't work with Python 3 or at all): class _AddDataMixin(object):
def __init__(self, *args, **kwargs):
self.data_list = []
super(_AddDataMixin, self).__init__(*args, **kwargs)
def add_data(self, data):
self.data_list.append(data)
def resample(self, data):
super(_AddDataMixin, self).resample(combine_data(data, self.data_list)) |
Can you spell out the use case you have in mind? Maybe gluing some data to a distribution for when we're working in a semi-supervised setting? |
yeah, that was more or less what I was thinking of. Perhaps there's some Also, what's the convention you're following for adding On 08/07, Matthew Johnson wrote:
|
I think it's a Python convention to put an underscore in front of "internal" things that aren't part of the user API. Or maybe I just made it up. |
Got it. Just thinking that in this case one really wants to encourage reuse of the traits by users -- i.e., folks adding new distributions and (derived) models. I might get around to doing this. It seems like it's worthwhile just for teaching, e.g., show somehow how to get samples from a GaussianModel (derived from |
So the distinction between Model and Distribution is confusing for very simple models (e.g., sometimes a Gaussian is the model; you want to .add_data to that.). What about a class decorator or metaclass wrapper that creates a DistNameModel for each DistName with no code duplication.
Or perhaps you're considering other API changes?
The text was updated successfully, but these errors were encountered: