I have data with potentially 3 switch points:

The model will automatically choose Metropolis for the sampling of the tau_1 and tau_2, and NUTS for the lambdas.

N = np.arange(0, all_points)

with pm.Model() as model:

alpha = 1.0/data.mean()

lambda_1 = pm.Exponential(“lambda_1”, alpha)

lambda_2 = pm.Exponential(“lambda_2”, alpha)

lambda_3 = pm.Exponential(“lambda_3”, alpha)`tau1 = pm.DiscreteUniform("tau1", lower=N.min(), upper=N.max()) tau2 = pm.DiscreteUniform("tau2", lower=tau1, upper=N.max()) _mu = T.switch(tau1>=N,lambda_1,lambda_2) mu = T.switch(tau2>=N,_mu,lambda_3) observation = pm.Poisson("obs", mu, observed=data) trace = pm.sample(10000, tune=1000)`

When tune=500 it doesn’t converge, but with tune=1000, both tau’s converge successfully.

**Can you please share with me and the Pymc3 community how tuning works or what should be considered when tuning a Metropolis. Do you know of articles/websites where I could read more about tuning of the Metropolis?**