-
Notifications
You must be signed in to change notification settings - Fork 28
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
Support julia 0.5 #135
Support julia 0.5 #135
Changes from all commits
2cf4a48
df09781
072a82c
1c04180
23f0068
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
julia 0.4 | ||
Compat | ||
DataFrames | ||
Distributions | ||
DocOpt | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,9 +72,10 @@ function subtract_kl!{NumType <: Number}( | |
mp::ModelParams{NumType}, accum::SensitiveFloat{CanonicalParams, NumType}; | ||
calculate_derivs::Bool=true, calculate_hessian::Bool=true) | ||
|
||
|
||
# The KL divergence as a function of the active source variational parameters. | ||
function subtract_kl_value_wrapper{NumType <: Number}(vp_vec::Vector{NumType}) | ||
elbo_val = zero(NumType) | ||
function subtract_kl_value_wrapper{NumType2 <: Number}(vp_vec::Vector{NumType2}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was causing a seg fault in 0.5, rather than an error |
||
elbo_val = zero(NumType2) | ||
vp_active = reshape(vp_vec, length(CanonicalParams), length(mp.active_sources)) | ||
for sa in 1:length(mp.active_sources) | ||
vs = vp_active[:, sa] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ else | |
end | ||
end | ||
|
||
|
||
println("Running hessian tests.") | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ using Base.Test | |
|
||
using Celeste: Types, SampleData, Transform, SensitiveFloats | ||
import Celeste: ModelInit, ElboDeriv | ||
|
||
using Compat | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for removing all the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing them before seemed like a good thing to do...I didn't realize how soon we'd need them again |
||
|
||
function test_transform_sensitive_float() | ||
blob, mp, body, tiled_blob = gen_two_body_dataset(); | ||
|
@@ -280,13 +280,13 @@ function test_transform_simplex_functions() | |
this_scale * Transform.unsimplexify_parameter(param, unscaled_simplex_box)) | ||
|
||
# Test the bound checking | ||
@test_throws(Exception, | ||
@test_throws(AssertionError, | ||
Transform.unsimplexify_parameter([ lb - 1e-6, 1 - lb + 1e-6 ], simplex_box)) | ||
@test_throws(Exception, | ||
@test_throws(AssertionError, | ||
Transform.unsimplexify_parameter([ 0.3, 0.8 ], simplex_box)) | ||
@test_throws(Exception, | ||
@test_throws(AssertionError, | ||
Transform.unsimplexify_parameter([ 0.2, 0.3, 0.5 ], simplex_box)) | ||
@test_throws(Exception, Transform.simplexify_parameter([ 1., 2. ], simplex_box)) | ||
@test_throws(AssertionError, Transform.simplexify_parameter([ 1., 2. ], simplex_box)) | ||
end | ||
end | ||
|
||
|
@@ -315,9 +315,9 @@ function test_transform_box_functions() | |
this_scale * Transform.unbox_parameter(param, unscaled_param_box)) | ||
|
||
# Test the bound checking | ||
@test_throws Exception Transform.unbox_parameter(lb - 1.0, param_box) | ||
@test_throws AssertionError Transform.unbox_parameter(lb - 1.0, param_box) | ||
ub < Inf && | ||
@test_throws Exception Transform.unbox_parameter(ub + 1.0, param_box) | ||
@test_throws AssertionError Transform.unbox_parameter(ub + 1.0, param_box) | ||
end | ||
end | ||
|
||
|
@@ -361,7 +361,7 @@ function test_enforce_bounds() | |
mp.vp[2][ids.r1[2]] = transform.bounds[2][:r1][1].upper_bound + 1.0 | ||
mp.vp[3][ids.k[1, 1]] = transform.bounds[3][:k][1, 1].lower_bound - 0.00001 | ||
|
||
@test_throws Exception transform.from_vp(mp.vp) | ||
@test_throws AssertionError transform.from_vp(mp.vp) | ||
Transform.enforce_bounds!(mp, transform) | ||
transform.from_vp(mp.vp) # Check that it now works | ||
|
||
|
@@ -375,15 +375,15 @@ function test_enforce_bounds() | |
mp.vp[sa][ids.r1[2]] = transform.bounds[1][:r1][1].upper_bound + 1.0 | ||
mp.vp[sa][ids.k[1, 1]] = transform.bounds[1][:k][1, 1].lower_bound - 0.00001 | ||
|
||
@test_throws Exception transform.from_vp(mp.vp) | ||
@test_throws AssertionError transform.from_vp(mp.vp) | ||
Transform.enforce_bounds!(mp, transform) | ||
transform.from_vp(mp.vp) # Check that it now works | ||
|
||
end | ||
|
||
|
||
test_transform_sensitive_float() | ||
test_transform_box_functions() | ||
test_transform_sensitive_float() | ||
test_box_derivatives() | ||
test_box_simplex_derivatives() | ||
test_simplex_derivatives() | ||
|
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.
We probably didn't mean to compare a boolean to an int before, but for whatever reason 0.4 doesn't complain, while 0.5 stops.