SMTorg / smt

Surrogate Modeling Toolbox
https://smt.readthedocs.io/en/stable
BSD 3-Clause "New" or "Revised" License
671 stars 201 forks source link

Question on drawing drawing sample from MFK GP posterior. #475

Open jtneedels opened 10 months ago

jtneedels commented 10 months ago

Hi,

I'd like to be able to draw a sample from my MFK GP posterior - that is a multivariate Gaussian based on the the posterior mean and covariance. I don't see a method to generate a sample in the code (just want to check if I am missing it). Otherwise, is there a way to output the full posterior covariance matrix, rather than just the variance, so that I can generate my own samples?

Thanks so much for the help!

relf commented 10 months ago

Hi,

You're right, currently there is no API for sampling MFK GPs or accessing covariance matrices directly. If you want to implement such methods take a look at krg_sampling.py where sampling for kriging is implemented. You could mix and match the code with the one of MFK to get what you want... And then feel free to contribute with a PR :wink:

Paul-Saves commented 10 months ago

Yes, you can sample and generate the covariance matrix within SMT. Everything is included in the utils folder:

jtneedels commented 10 months ago

Great, thank you both so much! I'll take a look at this code and tutorial.