필터 지우기
필터 지우기

model parameter estimation from RMSE between modeled outputs and observations

조회 수: 9 (최근 30일)
DK
DK 2020년 12월 22일
댓글: Jeff Miller 2020년 12월 27일
Hello,
I am a hydrologist, and trying to estimate soil parameters by using RMSE between modeled outputs (streamflow) and observed ones.
For example, a watershed model is applied from 1980 to 2000 with an initial set of parameters. RMSE can be calcuated between modeled streamflow and observed ones.
With the RMSE values, is there any matlab function to search a new set of parameters to try to reduce RMSE?
The curve for RMSE over an iteration would be ideally converged in a global minimization point.
Thanks!

답변 (2개)

Jeff Miller
Jeff Miller 2020년 12월 23일
I assume the model is too complex for regression, etc. In that case, you might be able to do this with fminsearch, if there are not too many parameters. You write a function to compute RMSE for any given parameter vector, and fminsearch will try to find the parameter values that will minimize that function.
  댓글 수: 3
Jeff Miller
Jeff Miller 2020년 12월 24일
This forum seems to have a number of examples using fminsearch in various ways. Not sure if any of them minimize RMSE specifically, but the general principles are the same regardless of what error function you compute.
DK
DK 2020년 12월 26일
Dear Jeff,
Below is my code to conduct a sensitivity test with varying two parameters (dsnowi, grfactor) of the function (msnow). RMSE (YEH, and Tb) is calculated at the end of the loop, but it would be great, preceeding guesses of the parameters help to search the optimized ones with the minimized RMSE.
function rresult = calibgrain(DBn_2,dateob,Tb)
dss = linspace(0.01,3,100);
ggf = linspace(0.5,5,100);
rresult = [];
for ii = 1:length(dss)
for jj = 1:length(ggf)
dsnowi = dss(ii);grfactor = ggf(jj);
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH, YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
rmsecomp = calcrmse(YEH,dateob,Tb);
rresult = [rresult ;dsnowi grfactor rmsecomp];
jj
end
ii
%jj
end

댓글을 달려면 로그인하십시오.


Jeff Miller
Jeff Miller 2020년 12월 26일
Something like this. If it is too slow, note that you can use 'optimset' to pass fminsearch options that make it finish faster (at the loss of a little precision in your parameter estimates).
function rresult = calibgrain(DBn_2,dateob,Tb)
dss = linspace(0.01,3,100);
ggf = linspace(0.5,5,100);
rresult = [];
for ii = 1:length(dss)
for jj = 1:length(ggf)
dsnowi = dss(ii);grfactor = ggf(jj);
startparms = [dsnowi,grfactor];
bestparms = fminsearch(@RMSE1,startparms);
dsnowi = bestparms(1);
grfactor = bestparms(2);
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH, YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
rmsecomp = calcrmse(YEH,dateob,Tb);
rresult = [rresult ;dsnowi grfactor rmsecomp];
jj
end
ii
%jj
function thisrmse = RMSE1(parms)
% nest this function inside calibgrain so that it has
% access to all of calibgrain's variables.
dsnowi = parms(1);
grfactor = parms(2);
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH, YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
thisrmse = calcrmse(YEH,dateob,Tb);
end
end
  댓글 수: 5
DK
DK 2020년 12월 27일
Hi Jeff,
You are very helpful! By the way, I got the error message at 200th line of fminsearch
Not enough input arguments.
Error in calibgrain/RMSE1 (line 25)
[dsns_2,lws,btotals,phis,dsnows_y2_r1,tsnows,sds_0,kss,tsss,gds,outmelts,YEH,YEV,YEVH,
YEHV,result,compaction,ritisi,stor,ro] = msnow(1,6552,DBn_2,dsnowi,grfactor);
Error in fminsearch (line 200)
fv(:,1) = funfcn(x,varargin{:});
Error in calibgrain (line 11)
bestparms = fminsearch(@RMSE1,startparms);
Any solution for this?
Thank you very much!
Jeff Miller
Jeff Miller 2020년 12월 27일
Sorry, I don't see what is causing that. Is it possible that your original call to calibgrain (outside of all this code) did not pass its required 3 parameters?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Oceanography and Hydrology에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by