What is your final goal? I don't really quite even know which of the parameters you're interested in and which you aren't. It sounds like you don't actually care about the individual values of the the . If that's the case you could probably marginalize them out. Then again I don't know how easy that would be since it depends on what your p(theta, B, f) looks like.