Can I make out-of-sample predictions using posterior means? Or how to use scipy.optimize with pymc predictions?

The idea is to make such kind of optimizations as in pymc_marketing.mmm.budget_optimizer.BudgetOptimizer

But I need more control on them