0
$\begingroup$

I want to learn a joint distribution on $n$ Bernoulli random variables conditioned on a random variable $b\sim D$ and parametrized by a neural network, $f$:

$$p(A = (a_1, \ldots, a_n)|b) = f_{\Lambda}(b).$$

I require that $\langle A \rangle = \frac{1}{n}\sum_{i=1}^n E[a_i] = p_0$ where $p_0$ is some fixed (typically small) number. Each $A$ is evaluated by some loss function $L(A,b)$. I have tried solving the regularized problem

$$\text{minimize} \ E_{b\sim D}[L(A,b; \Lambda) + \eta (\langle A\rangle - p_0)^2]$$

with backprop, but I find it is difficult to tune $\eta$. Is there some way to impose a hard constraint?

$\endgroup$

1 Answer 1

0
$\begingroup$

You could have the network parameterize just the first $n-1$ bernoulli RVs and set $p_{n} = np_0 - \sum_i^{n-1} p_i$ defining ($p_i = E[a_i]$). If $p_n$ isn't in $[0,1]$ then "back up" one more step, and set $p_{n-1} = p_n = np_0 - \sum_i^{n-2} p_i$. If this still doesn't keep $p_n$ in $[0,1]$, keep "backing up" until it does.

$\endgroup$
4
  • $\begingroup$ I am not sure I follow. The idea is use p_n to model the regularizer in the loss I proposed? I don't yet see how that hardens my constraint. And is the sum in p_j=n*p_0 + sum(p_i) taken over all i \neq j? $\endgroup$
    – MRicci
    Commented Jul 17, 2020 at 15:35
  • $\begingroup$ @MRicci as a concrete example -- if $n=3$, and you want to enforce $\frac{1}{3}(p_1+p_2+p_3) = 0.7$, then simply fix $p_3 = 2.1-p_1-p_2$, and your constraint is always satisfied. $\endgroup$
    – shimao
    Commented Jul 17, 2020 at 15:39
  • $\begingroup$ Yes, I see what you mean, but my loss, L, depends on there being exactly n random variables so that I'm not sure the addition of an auxiliary variable that technically makes the constraint true (on the enlarged set of variables) solves my problem. $\endgroup$
    – MRicci
    Commented Jul 17, 2020 at 15:50
  • $\begingroup$ right, so i'm suggesting that you use your network to parameterize $n-1$ variables, then force the constraint to be true with the last one. It's not an additional auxiliary variable, it's just the last variable you need to reach $n$. $\endgroup$
    – shimao
    Commented Jul 17, 2020 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.