thouska / spotpy

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

SCE-UA&MATLAB fminicon #282

Open dingxinjun opened 2 years ago

dingxinjun commented 2 years ago

when i see the optimize code in matlat using fminicon algorithm to serach for the parameter use 5minitue, i using SCEUA in python set repetion=800000 can have the same optimised params as matlab,but python is time consuming using nearly40 minute,cause i have 60 params. i also try repetion=10000, bur can't get the best params. so iwant to ask how to spped up the code under repetion=800000

thouska commented 2 years ago

Hi @dingxinjun, thank you for your message and for using SPOTPY. In general SPOTPY itself together with sceua shouldn't consume much time for 800000 repetitions. Probably a few minutes, but not 40. You can test how long it takes on your machine by using this example. Just select sceua only and set the repetitions accordingly. Is it possible that your model with the 60 parameters is the bottleneck? What might help to speed up your model, i.e. everthing you do inside of def simulation, to compile with jit. There is also an example for spotpy available. That help me to speed up things quite significant.

dingxinjun commented 2 years ago

thank you! using numba in the simulation can speed up the modeling code, i want to know whether using the parallel in the PC can speed up the calibration repetition? Dear thouska, I have send the code to you, i'm not sure why the repetition set tomore than 100000 can find the optimal params, repetition set to 10000 can not find the optimal params in SCEUA ,or whether there need to set any param in the SPOTPY to make the SPOTPY faster.

thouska commented 2 years ago

yes, parallel computing could potentialy speed up the calibration (depends on multiple factors). It's worth a try.

Regarding the speed up for sceua, yes there are parameters, which will effect the number of needed repetitions.

Rough rule of thumb: low ngs setting : low amout of repetitions needed, low robustness of results high ngs seeting: high amount of repetitions needed, high robustness of results Recommendation: Set somewhere around the number of parameters to optimize, i.e. 60 in your case.

pcento and peps: Increase, if you are less interested in a super accurate final objective function. This will decrease the number of needed repetitions. Unfortunatelly, I haven't receive your code, so thats a general advice. I hope it still helps a bit.

For more details I recommend to check out https://doi.org/10.1016/0022-1694(94)90057-4 if not already done.

dingxinjun commented 1 year ago

Dear Professor:

Thanks for yourreply. Because when the repletion set 10000 can’t find the optimal hydrologicalparams,the NSE LESS THEN 0.5,when I set repletion as 800000 it’ get better,NSE willbe 0.72.Actually I test my code again with 800000 repetition, it’s really timeconsuming and I don’t know how to set the params of spotpy to speed up thecode, so I sent you my code. The main function in the main_debug_zhang.py andthe calibrate function using the spotpy, the modeling.py (SNOW_ZDWBM  function)is the calculating py. please helpme diagnose the code, find the reason why it’s time consuming and how to speed it up.

------------------ 原始邮件 ------------------ 发件人: "thouska/spotpy" @.>; 发送时间: 2022年4月21日(星期四) 晚上10:43 @.>; 抄送: "l _ @.**@.>; 主题: Re: [thouska/spotpy] SCE-UA&MATLAB fminicon (Issue #282)

Hi @dingxinjun, thank you for your message and for using SPOTPY. In general SPOTPY itself together with sceua shouldn't consume much time for 800000 repetitions. Probably a few minutes, but not 40. You can test how long it takes on your machine by using this example. Just select sceua only and set the repetitions accordingly. Is it possible that your model with the 60 parameters is the bottleneck? What might help to speed up your model, i.e. everthing you do inside of def simulation, to compile with jit. There is also an example for spotpy available. That help me to speed up things quite significant.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>