thouska / spotpy

A Statistical Parameter Optimization Tool
https://spotpy.readthedocs.io/en/latest/
MIT License
247 stars 149 forks source link

Does spotpy's Dream not exactly Vrugt, J. A. (2016) proposed Dream? #285

Closed BeingHapppy closed 2 years ago

BeingHapppy commented 2 years ago

Hi, @thouska

I have tried to fix the missing function of dream. This is my first pull request. I am not sure I am on the right way. My classmate thinks my work is unnecessary, because he is used to using spotpy dream to complete his experiments, so he thinks my work may trouble him, but I don't know how to write code that can take care of his idea. What do you think?

The main change is: using a random number of chain pairs to generate the jump of the dream, which in spotpy now is only one pair.

parameter delta is the biggest number of chain pairs to generate the jump, parameter c is for creating lambda, parameter nchain_pairs is number of chain pairs actually used for a jump,

To be consistent with the source code (random_par_set1[i]-random_par_set2[i]), I changed the sum of the difference to “sum first and then do the difference”

If there is any room for improvement, please advise, I am willing to continue to revise.

Best wishes, Yantong Wu

thouska commented 2 years ago

Hi @BeingHapppy, I double checked your contribution and I am super happy to say, that it all looks very good. I think with your contribution the missing features as described by you in #284 are covered. Your classmate is certainly right, the changes will alter the results gained with the Dream algorithm in Spotpy. This can cause some troubles. But, on the other hand: 1) it is important to reproduce the orginal code as best as possible. 2) I ran some test and can say your implementation seems robust and the actual final results change only slightly 3) your contribution will result in a new spotpy version (1.5.15). So everyone who doesn't want to use the most recent version, can do so (which I however do not recommend).

I will add the missing changes to change the version number of spotpy with your pull request now. So what do you think, should we merge? Thank you again for your contribution, and the time, effort, profession! It is highly appreciated!

Cheers, Tobias

BeingHapppy commented 2 years ago

Hi @thouska, Yes, I am happy that you would like to merge it. Thank you for giving me the opportunity to participate in the improvement of spotpy dream, which I didn't dare to dream of. Thank you for your affirmation, it will greatly promote my confidence in programming!

cheers, Yantong