How to trace a subsample of the parameters

Hi, I was wondering if there was any easy way to sample a given subset of parameters when using, to keep only a trace for some parameters of interest instead of all the parameters in the model.

To be clearer, assume that I have a model with 3 parameters a, b and c, and that I am only interested in getting the (a, b) trace, and that I am not carrying about c. However, if c is a (1000x1000) matrix, it will use a lot of memory and I would like to avoid this since I won’t be using this parameter anyway

n PyMC3, you can use the trace function with the varnames parameter to selectively keep traces for specific parameters. Here’s a brief example:
mport pymc3 as pm

with pm.Model() as model:
# Define your model

trace = pm.sample(draws=1000, tune=500)
selected_params = [‘parameter1’, ‘parameter2’]
subset_trace = trace[vars(selected_params)]

Adjust the selected_params list to include the parameters you’re interested in. Check Welcome to the Pyro Discussion Forum!
here pls

Thank you