What is the best way to save the result object from scipy.optimize.OptimizeResult, so that its parameters can be easily accesses from the saved file? I am currently saving the result as a string. But this way, when I need to refer to it again, I need to parse the entire string to identify objects such as the parameter array, or the function value. Is there a more direct way to just save the entire object as it is without any changes to the object type, so when I read the file again, I can access the object type in the same way as if it was output from the original function?

res1 = scipy.optimize.minimize(...)
parameter_array1 = res1.x #Here, I can access parameter array like so

save(res1) #Some function that will allow me to save the result object 

res2 = load(res1)

parameter_array2 = res2.x #I want to be able access the parameter array just as I did above

0

There are 0 best solutions below