-
Notifications
You must be signed in to change notification settings - Fork 31
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
Order of Array Parameters is not Preserved by get
#311
Comments
They are returned in the order in which they appear in the chain. Since you constructed the chain in such a way that the first parameter belonging to |
You can use sorted_chain = sort(c)
sorted_xs = get(sorted_chain, :x).x
sorted_xs[1] == c["x[1]"] # true
sorted_xs[2] == c["x[2]"] # true
sorted_xs[11] == c["x[11]"] # true |
This may affect the reliability of the In a multi-level model like this.
The obtained chain has θ parameters in haphazard order.
OUTPUT:
The ordering of θ parameters is indicated as As a newbie like me, this weird behavior made me quite frustrating. Thanks. |
I was also bitten by this. By the way, a similar confusion can arise with simple julia> chains = Chains([10i+j for i in 1:2, j in 1:5], [:a, :b, :c, :d, :e]);
julia> Array(chains[[:d, :a, :e]])
2×3 Matrix{Int64}:
11 14 15
21 24 25 Here the matrix columns are not in the "requested" order. (Is there an easy way to get them in the desired order?) I guess a switch to AxisKeys (as suggested in #231) would help here too... |
If I have a chain with array parameters,
get
returns them in some random order, not numeric:This is a really bad bug for people who work with arrays....
The text was updated successfully, but these errors were encountered: