Skip to content

Linear model with log-link on sigma (exp(sigma)) errors: are there plans to support it in the future? #357

@DominiqueMakowski

Description

@DominiqueMakowski

I am trying to fit a simple linear model with some parameters expressed using a link-function (e.g., exp()) which is common to express priors in an unconstrained space.

using Random, RxInfer

y = randn(100)


RxInfer.@model function model_Gaussian(y)

    # Priors
    μ ~ RxInfer.NormalMeanVariance(0.3, 0.5)
    σ ~ RxInfer.NormalMeanVariance(log(0.2), 3)

    for i in eachindex(y)
        sigma = exp(σ)
        y[i] ~ RxInfer.NormalMeanVariance(μ, sigma)
    end
end

result = infer(
    model=model_Gaussian(),
    data=(y=y,),
)

Unfortunately, the above fails with:

ERROR: MethodError: no method matching exp(::GraphPPL.VariableRef{…})

In general, my question is about whether arbitrary link functions (such as that of StatsFuns) will be supported in the future?

Also, are there plans to make RxInfer work with a "standard" Distributions.Normal() rather than the bespoke NormalMeanVariance()?
Thanks for the clarifications!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions