Skip to content

BART crashing with MutableData #137

@DanielRobertNicoud

Description

@DanielRobertNicoud

Describe the bug
pymc_bart.BART fails to run when passing a MutableData response variable.

To Reproduce

import numpy as np
import pymc
import pymc_bart as pmb

X_train = np.random.normal(size=(100, 1))
y_train = np.random.normal(size=(100,))

with pymc.Model() as bart:
    # data containers
    X = pymc.MutableData("X", X_train)
    y = pymc.MutableData("y", y_train)
    # prior
    mu = pmb.BART("mu", X=X, Y=y, m=20)
    # sigma = pymc.HalfCauchy("sigma", beta=10)
    # likelihood
    likelihood = pymc.Normal("obs", mu=mu, sigma=.3, observed=y)
    
    idata = pymc.sample(random_seed=42)

Passing pmb.BART("mu", X=X, Y=y_train, m=20) instead works.

Expected behavior
The model should run normally.

Additional context

pymc==5.10.1
pymc-bart==0.5.7

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