Overfitting of computational model in experimental data

2 次查看(过去 30 天)
Hello everybody!
I have a set of experimental data from biaxial tensile tests which is stress and stretch for 2 axes (stress1, lamda1 and stress2, lamda2). I am trying to fit a model that is shown the Four_Fiber_Family_model.m. Briefly it is a model that calculates stress1 as a function of lamda1 and lamda2, and stress2 as a function of lamda1 and lamda2 again. This model has 8 parameters. I use fminsearch to fit the model in the Main_code_fitting.m. The objective function i minimize is s simple sum of squares function described in Objective_Func.m.
The problem is this:
It seems like the model "overfits" the data.
I would expext something like this (continuus smooth curve - as a model function should be):
but i get this:
Both of these images are from the same data sets, using the same mathematical model, same objective function etc. The only difference is the initial parameter guess.
In the first case it is : [1.1e-14, 152, 6.6e-19, 179.7, 2.3, 7.9e-20, 0.0003, 1.55]
In the second case it is : [15, 1, 1, 1, 0.5, 1, 1, deg2rad(55)]
It is not the fitting quality that concerns me, buth rather the fact that a different set of initial parameters can have that effect on the fitted curve. I am attatching a zoomed in version of the second image:
Even when i get rid of the multiple data points in y axis for the same value of x axis, this behavior is still present:
You can see that it follows the data in an unnatural way.
Has anybody seen that again? Do you have any suggestion on how to deal with it? How is it possible for the fitting to behave so differently in this way, by changing the initial parameters only?
Thanks in advance! Any help would be appreciated!!
P.S. I am attatching the code, the functions and 2 sets of data ("sample_anastasia.xls" and "130L-130C.xls") for anybody that is willing to play with it.

采纳的回答

Mathieu NOE
Mathieu NOE 2025-3-27
hello
fminsearch can be quite sensitive to IC, so even a slightly sub optimal IC value can lead to lack of performance / robustness. There coud be other, more robust optimizers to try (if you have the Optimisation Tbx)
otherwise I could get reasonnable results for both data files , after doing some modifications , the most important maybe is to take only the unique values from your experimental data and interpolate both y data sets on a common x axis
I put back all your files in attachment - hope it helps !
summary of my results
file = sample_anastasia.xls
R^2 for the longitudinal direction is: 0.9993
R^2 for the circumferential direction is: 0.9996
file = 130L-130C.xls
R^2 for the longitudinal direction is: 0.9876
R^2 for the circumferential direction is: 0.9962
main code modification :
%% keep only unique (and sort) data
[stretch_exp_l_unic,ia,ic] = unique(stretch_exp_l);
stress_exp_l_unic = stress_exp_l(ia);
[stretch_exp_c_unic,ia,ic] = unique(stretch_exp_c);
stress_exp_c_unic = stress_exp_c(ia);
% create common x axis
m = max(min(stretch_exp_l_unic),min(stretch_exp_c_unic));
n = min(max(stretch_exp_l_unic),max(stretch_exp_c_unic));
stretch = linspace(m,n,100)';
% interpolation
stress_exp_l = interp1(stretch_exp_l_unic,stress_exp_l_unic,stretch);
stress_exp_c = interp1(stretch_exp_c_unic,stress_exp_c_unic,stretch);
% overwrite stretch_exp_l and stretch_exp_c
stretch_exp_l = stretch;
stretch_exp_c = stretch;
this avoids the zig zags as you showed in your post
next I opted for slightly different IC (obtained from a first run of fminsearch) and also increased MaxIter to 1E4
another simple mod I made in the Objective_Func function is to replace the for loop by a simpler vectorized code :
% SS=0;
% for i = 1: length(lamda1)
% SS = SS +((stress_exp_1(i)-stress_mod_1(i))^2 + (stress_exp_2(i)-stress_mod_2(i))^2);
% end
% obj = SS;
% one line code :
obj=sum((stress_exp_1(:)-stress_mod_1(:)).^2 + (stress_exp_2(:)-stress_mod_2(:)).^2);
  3 个评论
Panagiotis
Panagiotis 2025-3-31
Thanks for the answer Mathieu, really useful!
They only problem is that the stretch in longitudinal axis goes up to ~1.21 (for the first set of data for example). When keeping the unique values and then creating a common axis (to avoid extrapolation) the highest stretch is the one from the circumferential axis which is ~1.17. So the values higher than that in the longitudinal axis are "lost", which is a problem.
So I guess keeping the unique data in each axis does not work for this case beacaue the arrays will be of a different size after that. Do you have any suggestions?
Thanks again!!
Mathieu NOE
Mathieu NOE 2025-3-31
oh yes , indeed , sorry for that - I was a bit quick on this matter
try the attached code - it should fix this problem
these are my results for both data sets :
file = sample_anastasia.xls
file = 130L-130C.xls

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by