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

Error when running the example in the readme #64

Closed
kskyten opened this issue Nov 20, 2019 · 5 comments
Closed

Error when running the example in the readme #64

kskyten opened this issue Nov 20, 2019 · 5 comments

Comments

@kskyten
Copy link

kskyten commented Nov 20, 2019

Running the following with the current registry version of Soss and on the master branch:

using Soss, Random

m = @model X begin
    β ~ Normal() |> iid(size(X,2))
    y ~ For(eachrow(X)) do x
        Normal(x' * β, 1)
    end
end;

Random.seed!(3)
X = randn(6,2)
rand(m(X=X))

gives me the following error:

ERROR: UndefVarError: interpret not defined
Stacktrace:
 [1] type2model(::Type{Model{NamedTuple{(:X,),T} where T<:Tuple,TypeEncoding(begin
    β ~ Normal() |> iid(size(X, 2))
    y ~ For(eachrow(X)) do x
            Normal(x' * β, 1)
        end
end),TypeEncoding(Main)}}) at ~/.local/share/julia/packages/Soss/g2PnG/src/core/model.jl:35
 [2] macro expansion at ~/.local/share/julia/packages/Soss/g2PnG/src/primitives/rand.jl:16 [inlined]
 [3] #s54#71(::Any, ::Any, ::Any) at ~/.local/share/julia/packages/GeneralizedGenerated/NDqgV/src/closure_conv.jl:121
 [4] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:524
 [5] rand(::Soss.JointDistribution{NamedTuple{(:X,),Tuple{Array{Float64,2}}},NamedTuple{(:X,),T} where T<:Tuple,TypeEncoding(begin
    β ~ Normal() |> iid(size(X, 2))
    y ~ For(eachrow(X)) do x
            Normal(x' * β, 1)
        end
end),TypeEncoding(Main)}) at ~/.local/share/julia/packages/Soss/g2PnG/src/primitives/rand.jl:8
 [6] top-level scope at REPL[14]:1
@kskyten
Copy link
Author

kskyten commented Nov 20, 2019

The example works in the dev branch.

@ghost
Copy link

ghost commented Nov 20, 2019

Are you on 1.2.0?

julia> using Soss, Random;

julia> m = @model X begin
           β ~ Normal() |> iid(size(X,2))
           y ~ For(eachrow(X)) do x
               Normal(x' * β, 1)
           end
       end;

julia> Random.seed!(3);

julia> X = randn(6,2);

julia> rand(m(X=X));

(v1.2) pkg> status Soss
    Status `~/.julia/environments/v1.2/Project.toml`
  [0bf59076] AdvancedHMC v0.2.13
  [31c24e10] Distributions v0.21.8
  [bbc10e6e] DynamicHMC v2.1.1
  [1a297f60] FillArrays v0.7.4
  [f6369f11] ForwardDiff v0.10.6
  [6fdf6af0] LogDensityProblems v0.9.2
  [d8e11817] MLStyle v0.3.1
  [91a5bcdd] Plots v0.27.0
  [8ce77f84] Soss v0.7.0 #master (https://github.com/cscherrer/Soss.jl.git)
  [4c63d2b9] StatsFuns v0.9.0
  [84d833dd] TransformVariables v0.3.8
  [de0858da] Printf 
  [9a3f8284] Random 
  [10745b16] Statistics

@kskyten
Copy link
Author

kskyten commented Nov 20, 2019

Yes, I'm using 1.2.0.

@cscherrer
Copy link
Owner

Thanks @kskyten, I think this is due to a change in GeneralizedGenerated 0.2; I didn't have version upper bounds (oops).

Works in dev (as you say), should also work to downgrade GeneralizedGenerated

@cscherrer
Copy link
Owner

Fixed in v0.8:

julia> using Soss, Random

julia> m = @model X begin
                  β ~ Normal() |> iid(size(X,2))
                  y ~ For(eachrow(X)) do x
                      Normal(x' * β, 1)
                  end
              end;

julia> Random.seed!(3);

julia> X = randn(6,2)
6×2 Array{Float64,2}:
  1.19156    0.100793  
 -2.51973   -0.00197414
  2.07481    1.00879   
 -0.97325    0.844223  
 -0.101607   1.15807   
 -1.54251   -0.475159  

julia> rand(m(X=X))
(X = [1.1915557734285787 0.10079289135480324; -2.5197330871745263 -0.0019741367391015213;  ; -0.1016067940589428 1.158074626662026; -1.5425131978228126 -0.47515878362112707], β = [0.07187269298745927, -0.5128103336795292], y = [0.10079289135480324, -2.5197330871745263, 2.0748097755419757, 0.8442227439533416, 1.158074626662026, -0.47515878362112707])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants