-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Generator op and auto minibatch scaling #1661
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
Conversation
allow one-sided patsy formula in linear_component
There is one but significant problem with generators. Any exception within calling |
pymc3/model.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if population
is the best name. population_size
, total_size
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like both population
and total_size
. total size
is probably more intuitive
pymc3/model.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs good doc-string.
pymc3/tests/test_theanof.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the casting should be necessary here?
pymc3/tests/test_theanof.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
This is really neat! What happens if the generator raises an exception? |
@twiecki then generator dies, I need to handle that case in some way or say user that it is dangerous. I think the latter is the only way I can solve the problem. |
I can check if generator is picklable as such generators don't die when exception is caught |
the second option is here (one more dependency and not always works) |
"generator dies" -- raises another exception, crashes the kernel? how does it look like exactly? |
@twiecki after exception generator raises |
I see, and in general this should never happen, the generators should be non-exhaustive. Thus, when that happens we can raise an exception that says that the generator stopped for unknown reasons and that we can't tell whether it was an exception. That seems acceptable to me. |
|
Well, that's triggered by the user so it should be fairly obvious what happened in that case. |
he will need to recompile the whole model |
I don't think we need to stress over this. The generator will most likely be fast so the probability that the KeyboardInterrupt would happen there is low. |
I'm stressed as risk is potentially high. Imagine DNN as a model. I would be disappointed |
OK, how about we do not raise an exception but just display a warning. Question is what to do next, I suppose the only way to exit gracefully would be to raise a |
Is that a general constraint with generators? That exceptions do not percolate up? |
These exceptions cannot be caught. If they appear inside |
Well, that's a limitation of the language then. I think we should move ahead with raising an Exception of the generator stops. If it becomes annoying later on we can think of other options. I really don't think it's all that critical. |
Good documentation is needed so |
Agreed, documentation will mention that. Do you instead want to merge this into your VI branch so that we can test how this would work in practice? |
Yes, I'll add documentation and then merge |
Merge 3.1 branch
initialize chains from estimated posterior samples
…ward-compatibility with lower case
Make init argument to sample case-insensitive
Added output for pointwise predictive accuracy in waic.
…tting (e.g. nanguardmode) for Theano functions
… mode setting (e.g. nanguardmode) for Theano functions" This reverts commit 6bdb53a069c6d569fadcbc36a93489c0ddb334a3.
This PR implements auto minibatching with appropriate likelihood scaling. Now generator can be passed to data.