Open torfjelde opened 4 years ago
How does 1 differ from 2?
The {..., Dims=1}
in Composed
. After #44 we'll have dimension information in Bijector
, and in the case of these "wrapper" bijectors, e.g. Composed
, it could be nice to show the dimensionality of the bijector:)
We can also drop the Dims=
and just write the dimensionality N
, which is similar to what you get by default for all other bijectors, e.g. Exp()
is displayed as Exp{0}()
because by default we assume Exp
to be 0-dimensional (can also instantiate as Exp{N}()
where N
is an integer)
I see, I think the dims is a good idea.
You can see how the README will look with dimensionality from PR #44 combined with the proposed Base.show
overload over at https://github.com/torfjelde/Bijectors.jl/tree/tor/show-overload
Would it make sense to use lower-case dim
instead of Dim
? I think this would be more julia style.
I'm not necessarily against that; my reasoning for choosing Dim
is because it's a type-parameter rather than an argument. Could also rename to D
or dim
as you suggested :)
Currently we've done nothing to improve the "visual inspection" of objects. At the moment it can be very difficult for the user to inspect a
Bijector
. And with PR #44 we're going to also have dimensionality in the type which makes it even more important to easily be able to inspect aBijector
.Sooo let's have another poll! Which of the following styles do you prefer:
Dims=1
for "container" types, e.g.Composed
andStacked
julia> Bijectors.Logit(0.0, 1.0) Logit{Float64}(a=0.0, b=1.0)
julia> Bijectors.composel([PlanarLayer(10) for i = 1:3]...) Composed{..., Dims=1}(ts=(PlanarLayer{Array{Float64,2},Array{Float64,1}}( w: [-1.10143; 1.33204; … ; -0.725184; -0.279187] u: [-0.755879; 1.6483; … ; 1.15966; -0.164425] b: [0.09642] ) , PlanarLayer{Array{Float64,2},Array{Float64,1}}( w: [-0.913726; -2.03212; … ; 0.0719403; -0.0622856] u: [-1.28574; -0.0194101; … ; -0.760258; 0.555373] b: [-0.951921] ) , PlanarLayer{Array{Float64,2},Array{Float64,1}}( w: [1.14896; 0.710024; … ; -2.24741; -0.904142] u: [0.917471; 1.07336; … ; -1.01782; 0.230862] b: [0.535096] ) ))
julia> Bijectors.Logit(0.0, 1.0) Logit{Float64}(0.0, 1.0)
julia> Bijectors.composel([PlanarLayer(10) for i = 1:3]...) Composed{Tuple{PlanarLayer{Array{Float64,2},Array{Float64,1}},PlanarLayer{Array{Float64,2},Array{Float64,1}},PlanarLayer{Array{Float64,2},Array{Float64,1}}},1}((PlanarLayer{Array{Float64,2},Array{Float64,1}}([0.700402; -0.489015; … ; -1.31095; -1.94269], [-0.199911; 1.38871; … ; -0.464837; 0.853309], [0.0885244]), PlanarLayer{Array{Float64,2},Array{Float64,1}}([-0.238407; -0.00701318; … ; 0.921103; 1.26528], [-0.17988; -0.0505573; … ; -0.886066; 1.18275], [0.467128]), PlanarLayer{Array{Float64,2},Array{Float64,1}}([0.231724; 0.39539; … ; -0.418577; -1.75923], [-0.055946; 1.37152; … ; 1.26864; -1.2355], [-0.636524])))