Skip to content

Conversation

@Nimrais
Copy link
Member

@Nimrais Nimrais commented Nov 23, 2025

This PR extends the base PR with projection based poisson likelihood model!

@Nimrais Nimrais requested a review from albertpod November 23, 2025 17:37
Base automatically changed from sts-dev to main November 24, 2025 19:29
@Nimrais
Copy link
Member Author

Nimrais commented Nov 24, 2025

@albertpod it's ready for review.

@Nimrais
Copy link
Member Author

Nimrais commented Nov 24, 2025

Old prediction with auxilary node:

Screenshot 2025-11-24 at 21 33 09

New prediction with projections:
Screenshot 2025-11-24 at 21 32 33

@albertpod
Copy link
Member

Going through the example.

  1. Getting the warning in the first cell:
    WARNING: using Distributions.Product in module ClosedFormExpectations conflicts with an existing identifier.
  2. Failed when running inference:
PosDefException: matrix is not positive definite; Factorization failed.

Stacktrace:
   [1] checkpositivedefinite
     @ ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/factorization.jl:68 [inlined]
   [2] #cholesky!#163
     @ ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/cholesky.jl:269 [inlined]
   [3] cholesky!
     @ ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/cholesky.jl:267 [inlined]
   [4] #cholesky!#164
     @ ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/cholesky.jl:301 [inlined]
   [5] cholesky! (repeats 2 times)
     @ ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/cholesky.jl:295 [inlined]
   [6] _cholesky
     @ ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/cholesky.jl:411 [inlined]
   [7] cholesky(A::Matrix{Float64}, ::NoPivot; check::Bool)
     @ LinearAlgebra ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/cholesky.jl:401
   [8] cholesky (repeats 2 times)
     @ ~/.julia/juliaup/julia-1.11.2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/LinearAlgebra/src/cholesky.jl:401 [inlined]
   [9] PDMat
     @ ~/.julia/packages/PDMats/8CRip/src/pdmat.jl:40 [inlined]
  [10] Wishart
     @ ~/.julia/packages/Distributions/psM3H/src/matrix/wishart.jl:65 [inlined]
  [11] convert(::Type{Wishart}, dist::ExponentialFamily.WishartFast{Float64, Matrix{Float64}})
     @ ExponentialFamily ~/.julia/packages/ExponentialFamily/prORE/src/distributions/wishart.jl:94
...
     @ ~/.julia/packages/RxInfer/UX7t9/src/inference/inference.jl:545 [inlined]
 [414] with_session(f::RxInfer.var"#312#314"{GraphPPL.ModelGenerator{typeof(rxsts_twist_poisson), @Kwargs{H::Vector{Float64}, X::Vector{Vector{Float64}}, R::Matrix{Int64}, priors::Dict{Symbol, ContinuousDistribution}}, GraphPPL.PluginsCollection{Tuple{}}, RxInfer.ReactiveMPGraphPPLBackend{Static.False}, String}, @NamedTuple{y::Vector{Union{Missing, Int64}}}, Nothing, Nothing, RxInfer.InitSpecification, GraphPPL.Constraints{Vector{GraphPPL.FactorizationConstraint}, Vector{GraphPPL.MarginalFormConstraint}, Vector{GraphPPL.MessageFormConstraint}, Dict{Function, GraphPPL.GeneralSubModelConstraints}, Dict{GraphPPL.FactorID, GraphPPL.SpecificSubModelConstraints}, String}, GraphPPL.MetaSpecification, @NamedTuple{limit_stack_depth::Int64}, KeepLast, Nothing, Nothing, Nothing, Int64, Bool, Tuple{RxInfer.ObjectiveDiagnosticCheckNaNs, RxInfer.ObjectiveDiagnosticCheckInfs}, Bool, Bool, Bool, Nothing, Nothing, DefaultPostprocess, Nothing, Bool, Bool, Bool}, session::RxInfer.Session, label::Symbol)
     @ RxInfer ~/.julia/packages/RxInfer/UX7t9/src/session.jl:253
 [415] #infer#311
     @ ~/.julia/packages/RxInfer/UX7t9/src/inference/inference.jl:515 [inlined]

@Nimrais
Copy link
Member Author

Nimrais commented Nov 24, 2025

Getting the warning in the first cell:
WARNING: using Distributions.Product in module ClosedFormExpectations conflicts with an existing identifier.

It's not really important julia just not happy that ClosedFormExpectations.jl has a struct Product and Distributions.jl also has it. It just mean that if you will use it in this notebook you would need to specify the package like ClosedFormExpectations.Product or Distributions.Product. But such situation would never happen in this notebook :).

Failed when running inference:

That is annyoing FastCholesky not happy with some small numbers, I will play with the precision. I see it also fails in the CI.

@Nimrais
Copy link
Member Author

Nimrais commented Nov 24, 2025

I am not really experienced with FastCholesky. Inference in my example is running and I do not see any strange results. But because of some numerical issues, a matrix that is supposed to be symmetric is slightly asymmetric. So I decided to just do the following at runtime:

### EXAMPLE_HIDDEN_BLOCK_START ###
delete!(ENV, "JULIA_FASTCHOLESKY_THROW_ERROR_NON_SYMMETRIC");
nothing
### EXAMPLE_HIDDEN_BLOCK_END ###

I do not know why this variable is set to throw an error for all examples if FastCholesky.jl itself does not throw an error by default. Should it not be set for the specific examples where we want to throw an error?

@Nimrais
Copy link
Member Author

Nimrais commented Nov 25, 2025

@bvdmitri maybe you are able to help.

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

Successfully merging this pull request may close these issues.

3 participants