If I define the distribution on a variable based on some conditions, like w in below code:

gamma[featureRange] = Variable.Bernoulli(rhoPriors[featureRange]);
using (Variable.ForEach(featureRange)) spike[featureRange] = Gaussian.FromMeanAndVariance(0, 0.0000001);
using (Variable.ForEach(featureRange)) slab[featureRange] = Gaussian.FromMeanAndVariance(0, 1);
using (Variable.ForEach(featureRange))
{
using (Variable.If(gamma[featureRange]))
{
w[featureRange] = Variable<double>.Random(slab[featureRange]);
}
using (Variable.IfNot(gamma[featureRange]))
{
w[featureRange] = Variable<double>.Random(spike[featureRange]);
}
}

Is it possible to infer w directly and use the values directly from this inferred w? And are these inferred values for w usable for test purposes? Or I should infer gamma and state w in terms of gamma?

I get some very large values for w, which is not logical in my case. I wanted to ask if it is at all possible to use engine.infer<Gaussian[]>(w). Thanks a lot.

My model is a simple regression. Actually when I put a constraint on w, the result become really great. That's while putting such a constraint on w, makes no sense in theory. I was wondering how the value of w can be used.

// my ConstrainPositive on w
Variable.ConstrainPositive(w[featureRange]);