dfm / george

Fast and flexible Gaussian Process regression in Python
http://george.readthedocs.io
MIT License
445 stars 128 forks source link

How to copy a GP object? #144

Closed syrte closed 3 years ago

syrte commented 3 years ago

What is the best solution to copy a george.GP object? e.g., I have a trained GP object, then I want to make some changes (e.g., kernel or kernel params) to it but also keep the original one for comparision.

How about the standard library function copy.deepcopy? Thanks!

dfm commented 3 years ago

Good question! I think that a deepcopy should work just fine. Did you find that it didn't work as expected?

syrte commented 3 years ago

Thanks for the reply! It seems to work well in my case. A minor issue is that it will copy the input arrays as well, which could be unnecessary sometimes. It is usually not a problem as I see. Feel free to reopen if anyone has something to add.