ReactiveMP.jl icon indicating copy to clipboard operation
ReactiveMP.jl copied to clipboard

Keyword arguments not supported in non-linear node

Open bartvanerp opened this issue 2 years ago • 3 comments

The non-linear node does not support keyword arguments, e.g.

function foo(x1, x2; b=0)
    return x1 + x2 + b
end

@model function model_test(b)
    z1 ~ NormalMeanVariance(0.0, 1.0)
    z2 ~ NormalMeanVariance(0.0, 1.0)
    x ~ foo(z1, z2; b=b)
    y = datavar(Float64)
    y ~ NormalMeanVariance(x, 1.0)
end

fails with LoadError: Unknown option '$(Expr(:kw, :b, :b))' for 'foo' node.

bartvanerp avatar May 30 '23 07:05 bartvanerp

Hey @wouterwln! I believe this error is on ~GraphPPL side. Is it something difficult to fix? Otherwise I would just throw an error like: error("Keyword arguments are not supported for Delta node creation. Consider wrapping your function with keyword arguments into a keyword-free function.")

I am not sure how to fix it without touching ReactiveMP.jl. @bvdmitri is it something we want to support anyway?

albertpod avatar Oct 02 '23 13:10 albertpod

@albertpod this is fixed in GraphPPL 4.0 ;)

wouterwln avatar Oct 02 '23 15:10 wouterwln

@wouterwln awesome. Let's close once new GraphPPL is merged

albertpod avatar Oct 02 '23 15:10 albertpod