How to define likelihood by myself in Pymc3

It’s up to you, CustomDist with behave more like a traditional model variable, specially if you can provide a random method.

Thigs should work fine in V5 (no point in v4), just by default your get an InferenceData when you sample, but you can find the values easily in result.posterior["varname”].

If you have trouble someone here will be able to help you out.