Skip to content

Classification example? #89

Open
Open
@j-adamczyk

Description

@j-adamczyk

As far as I understand from the paper, the only thing needed to perform classification with BART, i.e. have binary response, is adding a probit link.

However, this question uses sigmoid (logistic link), but without pm.Deterministic:

with pm.Model() as model:
    x = pm.BART('x', X_shared.get_value(), Y_train)
    y = pm.Bernoulli('y', p=pm.math.sigmoid(x), observed=Y_train)
    trace = pm.sample()

Bayesian Computation Book in exercises 7M10 and 7M11 suggests modifying this code, which uses sigmoid, but with pm.Deterministic, like:

theta = pm.Deterministic("theta", pm.math.sigmoid(mu))

Another discussion uses inverse probit distribution, also with pm.Deterministic:

with pm.Model() as model_bart:
	mu = pmb.BART("mu", df_train_features, df_train_labels, m=200)
	theta = pm.Deterministic("theta", pm.math.invprobit(mu))
	y = pm.Bernoulli("y", p=theta, observed=df_train_labels)
	idata = pm.sample(random_seed=0, tune=200)

Which option should be used for BART binary classification? Also, adding BART classification example (even a very small code snippet) to the documentation would be really useful.

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