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

adding sampling functionality to linearregression model #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jattenberg
Copy link

i wanted to be able to sample predictions

Copy link
Owner

@parsing-science parsing-science left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a good addition @jattenberg! Thanks for adding it. Do you plan on adding a unittest for this new method? I think it might also be useful to update the corresponding Jupyter notebook to show how you might use this method.

@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [1.1.4] - 2018-07-21
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, I'm not sure if you're familiar with semantic versioning; the last number is reserved for bug fixes.
This is not a bug fix, so the version should be a minor version change, e.g. 1.2.0

@@ -93,17 +93,17 @@ def fit(self, X, y, inference_type='advi', minibatch_size=None, inference_args=N

return self

def predict(self, X, return_std=False):

def sample(self, X, samples=2000):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about calling this something like sample_posterior? I think it could help to be a bit more explicit.

@@ -93,17 +93,17 @@ def fit(self, X, y, inference_type='advi', minibatch_size=None, inference_args=N

return self

def predict(self, X, return_std=False):

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only need one blank line between methods per PEP8.


Parameters
----------
X : numpy array, shape [n_samples, n_features]

return_std : Boolean flag of whether to return standard deviations with mean values. Defaults to False.
samples : number of draws to make for each point
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add in the default value to this docstring? Like I do in the predict method below with return_std.


return_std : Boolean flag of whether to return standard deviations with mean values. Defaults to False.

samples: numberof draws to make for each input
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: number of. Please also add the default value.

@rlouf
Copy link
Contributor

rlouf commented Nov 26, 2018

If my understanding is correct, the predict function outputs the mean of y's posterior distribution. The mean is not the only choice possible and I would suggest specifying the underlying loss function in the docstring (squared-error loss in this example).

see Bayesian point estimation: https://en.wikipedia.org/wiki/Point_estimation#Bayesian_point_estimation

@rlouf
Copy link
Contributor

rlouf commented Jan 11, 2019

@jattenberg Are you still working on this?

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.

3 participants