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

Fix 173 #341

Merged
merged 33 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
219b9f4
Initial support for infix ~ (#173).
yebai Aug 28, 2017
cb5b054
Merge branch 'master' of github.com:yebai/Turing.jl
yebai Aug 28, 2017
ffb9407
seperate model wrapper call in sample.jl test
xukai92 Oct 3, 2017
2a9466d
update ForwardDiff.Dual signature
xukai92 Oct 3, 2017
1431b24
Merge branch 'master' into Fix-173
yebai Oct 3, 2017
d54e9da
Merge branch 'Fix-173' of github.com:yebai/Turing.jl into Fix-173
yebai Oct 3, 2017
008f41e
sample.jl test passed
xukai92 Oct 4, 2017
80df8fe
fix some tests for Julia 0.6
xukai92 Oct 4, 2017
74c7c5f
remove typealias for 0.6
xukai92 Oct 4, 2017
6d7feac
make some functions 0.6-ish
xukai92 Oct 4, 2017
b14035e
make abstract 0.6-ish
xukai92 Oct 4, 2017
551f122
Merge branch 'Fix-173' of https://github.com/yebai/Turing.jl into Fix…
xukai92 Oct 4, 2017
e038605
change some decpreated functions
xukai92 Oct 4, 2017
80b4db6
Update .travis.yml
yebai Oct 5, 2017
ac74f77
Update appveyor.yml
yebai Oct 5, 2017
06520fc
Update appveyor.yml
yebai Oct 5, 2017
1d8139f
fix test
xukai92 Oct 5, 2017
8c74ec6
Deprecations on package loading fixed
xukai92 Oct 9, 2017
d976b45
fix deprecations
xukai92 Oct 9, 2017
aecd4e7
implement callbacks for inner function
xukai92 Oct 10, 2017
f0fa67a
fix model type bug
xukai92 Oct 19, 2017
ced0eb8
Fix type
xukai92 Oct 22, 2017
1776c1f
update Dual in benchmark
xukai92 Oct 23, 2017
7401353
update Dual constructor
xukai92 Oct 23, 2017
4f461c0
Bump up required Julia version to 0.6
yebai Oct 24, 2017
36eeb26
Disable depreciated warning messages for `consume/produce`.
yebai Nov 9, 2017
d8b7ed0
Remove duplicate definition of produce.
yebai Nov 9, 2017
848e36a
Merge branch 'master' into Fix-173
yebai Nov 12, 2017
841df5c
fix floor, tanh, abs, log
xukai92 Nov 15, 2017
b895169
fix logpdf warning and bug
xukai92 Nov 15, 2017
a7bf48a
fix vec assume init
xukai92 Nov 15, 2017
fa57fc2
Merge branch 'master' into Fix-173
yebai Nov 16, 2017
3fd77af
Travis: Allow `Benchmarking` test to fail.
yebai Nov 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/samplers/sampler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ assume{T<:Distribution}(spl::Void, dists::Vector{T}, vn::VarName, var::Any, vi::
end
end

acclogp!(vi, sum(logpdf(dist, rs, istrans(vi, vns[1]))))
acclogp!(vi, sum(logpdf_with_trans(dist, rs, istrans(vi, vns[1]))))
Copy link
Member

Choose a reason for hiding this comment

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

@yebai Plz have a look at this change - do you agree what we had before was a bug?

Copy link
Member

Choose a reason for hiding this comment

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

@yebai This is actually (mathematically) correct ... as there is another bug - we didn't use customised init here for vectorised assume at all. I will push another commit to fix it.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes - it looks correct to me.


var
end
Expand All @@ -95,5 +95,9 @@ observe{T<:Distribution}(spl::Void, dists::Vector{T}, value::Any, vi::VarInfo) =
@assert length(dists) == 1 "[observe] Turing only support vectorizing i.i.d distribution"
dist = dists[1]
@assert isa(dist, UnivariateDistribution) || isa(dist, MultivariateDistribution) "[observe] vectorizing matrix distribution is not supported"
acclogp!(vi, sum(logpdf(dist, value)))
if isa(dist, UnivariateDistribution) # only univariate distributions support broadcast operation (logpdf.) by Distributions.jl
acclogp!(vi, sum(logpdf.(dist, value)))
else
acclogp!(vi, sum(logpdf(dist, value)))
end
end
4 changes: 2 additions & 2 deletions src/samplers/support/transform.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ link{T<:Real}(d::RealDistribution, x::Union{T,Vector{T}}) = x

invlink{T<:Real}(d::RealDistribution, x::Union{T,Vector{T}}) = x

logpdf_with_trans{T<:Real}(d::RealDistribution, x::Union{T,Vector{T}}, transform::Bool) = logpdf(d, x)
logpdf_with_trans{T<:Real}(d::RealDistribution, x::Union{T,Vector{T}}, transform::Bool) = logpdf.(d, x)


#########
Expand All @@ -103,7 +103,7 @@ link{T<:Real}(d::PositiveDistribution, x::Union{T,Vector{T}}) = log(x)
invlink{T<:Real}(d::PositiveDistribution, x::Union{T,Vector{T}}) = exp.(x)

logpdf_with_trans{T<:Real}(d::PositiveDistribution, x::Union{T,Vector{T}}, transform::Bool) = begin
lp = logpdf(d, x)
lp = logpdf.(d, x)
transform ? lp + log.(x) : lp
end

Expand Down