Conversation
@@ -139,7 +139,7 @@ def _format_number(num, n_signif_figures, max_width): | |||
""" | |||
if max_width < 6: | |||
raise NotImplementedError("Guaranteed formatting in fewer than 6 characters not supported.") | |||
if math.isnan(num): | |||
if math.isnan(num) or math.isinf(num): |
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.
This was failing when num
was infinite. I don't know if this is the way to deal with this in python.
@@ -637,7 +637,12 @@ def _get_valid_stan_args(base_args=None): | |||
|
|||
args['init_radius'] = args.get('init_r', 2.0) | |||
if (args['init_radius'] <= 0): | |||
args['init'] = "0".encode('ascii') | |||
args['init'] = b"0" |
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.
This bit correctly initializes to 0. This was slightly different behavior in Stan for the same args, but doing this will make it the same from PyStan.
@@ -941,6 +946,7 @@ def _writable_sample_file(file, warn=True, wfun=None): | |||
if wfun is None: | |||
wfun = lambda x, y: '"{}" is not writable; use "{}" instead'.format(x, y) | |||
dir = os.path.dirname(file) | |||
dir = os.getcwd() if dir == '' else dir |
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.
When file
is just the name of a file, os.path.dirname(file)
returns ''
, which was failing on the next call os.access(dir, os.W_OK)
. By checking if it's ''
and returning the current working directory, this now allows the files to get written to the working directory. Is that ok?
@@ -21,8 +21,8 @@ def test_init_zero_exception_inf_grad(self): | |||
""" | |||
sm = StanModel(model_code=code) | |||
assertRaisesRegex = self.assertRaisesRegexp if PY2 else self.assertRaisesRegex | |||
with assertRaisesRegex(RuntimeError, 'Gradient evaluated at the initial value is not finite.'): | |||
sm.sampling(init='0', iter=1) | |||
with assertRaisesRegex(RuntimeError, ''): |
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.
Now, the error message from Stan is written as a message and not in the exception message.
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.
does the message get to the user somehow? What's the new exception message? (If there's an exception message, that could be checked here.)
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'm not sure -- I think the error is handled slightly differently now. Wow... I don't even remember changing these tests. Do you want me to hunt down the difference?
@ariddell, the code all runs, but I don't think I'm getting the output correctly propagated. Some of the output looks like all zeros. But everything works. Can you review and let's talk about how we can get everything working? |
by works, I mean that it runs and I get output back out to python. |
I'll keep an eye out. If there's something specific you saw, please open
an issue and I'll take care of it.
…On 12/30/2016 05:51 PM, Daniel Lee wrote:
@ariddell <https://github.com/ariddell>, the code all runs, but I don't
think I'm getting the output correctly propagated. Some of the output
looks like all zeros.
But everything works. Can you review and let's talk about how we can get
everything working?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<stan-dev/pystan#282 (comment)>, or
mute the thread
<https://github.com/notifications/unsubscribe-auth/AABN7ge5tz2iuqgEgVGBe-tFGP42Ymm-ks5rNYrtgaJpZM4LINbQ>.
|
Thanks! I saw there was a test error on travis, so I'll try to fix that
first.
On Sat, Dec 31, 2016 at 2:54 PM, Allen Riddell <notifications@github.com>
wrote:
… I'll keep an eye out. If there's something specific you saw, please open
an issue and I'll take care of it.
On 12/30/2016 05:51 PM, Daniel Lee wrote:
> @ariddell <https://github.com/ariddell>, the code all runs, but I don't
> think I'm getting the output correctly propagated. Some of the output
> looks like all zeros.
>
> But everything works. Can you review and let's talk about how we can get
> everything working?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <stan-dev/pystan#282 (comment)>, or
> mute the thread
> <https://github.com/notifications/unsubscribe-
auth/AABN7ge5tz2iuqgEgVGBe-tFGP42Ymm-ks5rNYrtgaJpZM4LINbQ>.
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<stan-dev/pystan#282 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_Fzz1IxA8zRd6prIuzAkk2MEOUr_Fks5rNrL1gaJpZM4LINbQ>
.
|
11eb2bb
to
790afe4
Compare
Is this ready to review and merge? |
Please review. As soon as stan-dev/stan#2004 has been merged, feel free to
merge!
…On Sun, Jan 8, 2017 at 9:38 PM, Allen Riddell ***@***.***> wrote:
Is this ready to review and merge?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<stan-dev/pystan#282 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_F0Modq8hl85Y3nceW47HJWAo73Ytks5rQZ2igaJpZM4LINbQ>
.
|
pystan.stan(model_code=model_code, iter=10, chains=1, seed=2, | ||
data=data, init=[dict(mu=4)], warmup=0) | ||
except RuntimeError: |
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.
this might be redundant. a RuntimeError will yield a failing test.
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.
Sure. Please remove.
Great. I'll fix the tests and merge today. |
Thanks. Let me know if you need more from me.
I stepped away for a couple weeks and it all looks foreign.
…On Tue, Jan 10, 2017 at 7:12 AM, Allen Riddell ***@***.***> wrote:
Great. I'll fix the tests and merge today.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<stan-dev/pystan#282 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAZ_F-Ozh6-lMbcKWru6EIZsralLxvxIks5rQ3WhgaJpZM4LINbQ>
.
|
fad7bb3
to
c400b59
Compare
Hey @syclik, can we add a message to the Python only knows that an exception has been encountered -- it doesn't know the exception type, so the "" isn't helpful. How about
edit: simplified things |
I made a pull request, stan-dev/stan#2203 |
Yes and thanks.
… On Jan 12, 2017, at 9:57 AM, Allen Riddell ***@***.***> wrote:
I made a pull request, #2203
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
c400b59
to
adf02d8
Compare
(Test failures were due to matplotlib not yet being available for Python 3.6) |
Summary:
This goes along with Stan's refactor. This updates PyStan so it's compatible with the changes to Stan.
Do not merge until stan-dev/stan#1751 is fixed.
Intended Effect:
Updates PyStan.
How to Verify:
Side Effects:
None.
Documentation:
None.
Reviewer Suggestions:
@ariddell
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):
Columbia University
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: