Skip to content

StackOverflowError when sampling from mixture model #249

@BenjaminJCox

Description

@BenjaminJCox

MWE:

using Distributions
using DistributionsAD
using Random

test_mm = MixtureModel([TuringDenseMvNormal(randn(10), collect(I(10))) for comp in 1:10])
rand(test_mm)

This type of code comes up as I construct a mixture distribution inside of the function I take the gradient of, so the construction of the mixture must explicitly be these distributions (otherwise one gets covert errors).

I have no idea why this behaviour happens, but it occurs even when only 1 component is in the mixture.
For now I can get around it by sampling the vector of distributions then sampling the result, but this is not ideal.

Metadata

Metadata

Assignees

No one assigned

    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