# How to model the following problem in Bayesian setting?

Let A, (m \times n), x of size n and y of size m. and all of them take boolean values.

And y = A * x ie (the result of A*x > 0). I want to enforce sparsity on x but its boolean.

How to model a problem like this in Bayesian setting? Any reading material or examples is much appreciated.

An example code for A*x: Boolean matrix multiplication in Julia - Stack Overflow

When you say enforce sparsity it suggests that the values of x are not fixed, and x is a parameter. But in Stan you cannot have discrete parameters.

Alternatively, if A, x and y are all data and transformed data, then is the question simply about how you can encode x sparsely? The sparse encoding would simply be to pass in a vector of the indices of x that are 1.

We are given y and A. For the given y and A I want to find x and also enforce sparsity on x ie number of non zero elements in it are to the minimum.

Even if stan can’t model discrete parameters, is there a way specify this model in bayesian setting?

I don’t understand what the model is. What is the stochastic piece?

1 Like