Open h-spiess opened 2 years ago
I have found this version in https://github.com/zenna/Omega.jl/blob/ee7afa521566b5de94fde26e465b77e9f553d822/OmegaExamples/docs/basictutorial.jl
nflips = 4
coinflips = Mv(Bernoulli.(weight), 1:nflips) # this is an array of RVs
randsample(coinflips)
But this gives:
ERROR: MethodError: no method matching length(::OmegaCore.Var.Pw{Tuple{Member{Beta{Float64}, Int64}}, Type{Bernoulli}})
Closest candidates are:
length(!Matched::Union{Base.KeySet, Base.ValueIterator}) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/abstractdict.jl:58
length(!Matched::Union{Tables.AbstractColumns, Tables.AbstractRow}) at ~/.julia/packages/Tables/PxO1m/src/Tables.jl:175
length(!Matched::Union{ArrayInterface.BidiagonalIndex, ArrayInterface.TridiagonalIndex}) at ~/.julia/packages/ArrayInterface/ZsAcl/src/array_index.jl:33
...
Ah, I think I have found the current version:
nflips = 4
coinflips = manynth(Bernoulli.(weight), 1:nflips) # this is an array of RVs
randsample(coinflips)
works :)
But afterwards the conditioning on observations is not working
observations = [1, 1, 1, 0]
condition = coinflips == observations # false
condition = coinflips .== observations # ERROR: MethodError: no method matching size(::Mv{UnitRange{Int64}, OmegaCore.Var.Pw{Tuple{Member{Beta{Float64}, Int64}}, Type{Bernoulli}}})
condition = coinflips ==ᵣ observations # ERROR: UndefVarError: ==ᵣ not defined
condition = coinflips ==ₚ observations # ERROR: UndefVarError: ==ₚ not defined
condition = coinflips ==ₛ observations # ERROR: MethodError: no method matching dist(::Mv{UnitRange{Int64}, OmegaCore.Var.Pw{Tuple{Member{Beta{Float64}, Int64}}, Type{Bernoulli}}}, ::Vector{Int64})
condition = coinflips ==̃ₚ observations # works but fails afterwards
weight_samples = randsample(weight |ᶜ condition, 10; alg = RejectionSample) # ERROR: MethodError: no method matching &(::Bool, ::SoftPredicates.DualSoftBool{SoftBool{Float64}})
Do you think it would be wise to wait until the API stabilizes?
Hey,
I wanted to play around with Omega.jl a bit and started with the Basic Tutorial.
Unfortunately,
randarray
is not defined inI'm using