Closed flydream0428 closed 3 years ago
Thanks for your message. Did you set the alt_objectfunc
keyword to None
?
sampler=spotpy.algorithms.sceua(spot_setup, dbname='SCEUA_hymod', dbformat='csv', alt_objfun=None)
This should force SCE-UA to use the def objectivefunction
in your spot setup class. If it is not set, SCE-UA ist using the + RMSE by default.
The idea behind this setting was to provide a well working setting. This resulted in the RMSE beeing hardcoded, because the algorithm is very sensitive to different objectivefunctions and might not perform well with other settings.
However, this way has proven to be not very intuitive. If you want, I can set the default to use the def obejctivefunction
.
Thanks, Tobias. I checked my code. I used alt_objectfun=None. I guess this is why it's very sensitive when I change the sign of RMSE. In the Rosenbrock example, this is not set. This means SCE-UA always uses the +RMSE. Is this right? Sorry, I am still very confused. For example, in the tutorial, http://fb09-pasig.umwelt.uni-giessen.de/spotpy/Tutorial/2-Rosenbrock/, you said " In this case we select the Root Mean Squared Error, giving the simulations and the evaluations. As we want to minimize our function, we select a negative objective function at this point.
def objectivefunction(self,simulation,evaluation):
objectivefunction= -spotpy.objectivefunctions.rmse(evaluation,simulation)
return objectivefunction"
But, in the tutorial, the None set is not activated. sampler=spotpy.algorithms.sceua(spotpy_setup, dbname='RosenSCEUA', dbformat='csv') results.append(sampler.sample(rep,ngs=4))
As this alt_objectfun
keyword resulted in quite some confusion, it was removed some time ago and all algorithms use the user defined objective function. To get some hint, which objective function should be used for which sampler, I introduced a keyword for each algorithm. It can be seen as a class parameter in every algorithm file or accessed after initializing the sampler, e.g.
sampler=spotpy.algorithms.sceua(spot_setup, dbname='sceua_output')
sampler.optimization_direction
Out[1]: 'minimizing'
Meaning that in this case the sce-ua sampler is minzing the user defined objective function, i.e. it work with the normal RMSE, without any minus sign. There is also an tutorial availble.
What is the right sign +/- when rmse objective funciton is used with SCE-UA? When I tried to run my model, with a negative sign before the rmse objective funciton objectivefunction= -spotpy.objectivefunctions.rmse(evaluation,simulation) , a high percentage of the model crashed. When I removed the -, the model didn't crash anymore although I didn't get a converging solution. Then I tested this sign with Rosenbrock example. I found it always works no matter what sign I use. This is not what I expected. I think a wrong sign should not work. Any idea?