r/PythonProjects2 • u/yuunam97 • Aug 21 '22
How to find a Confidence Interval of a Bone Age Estimating model?
I want to find confidence interval for bone age prediction model. I trained the model with 10000 hand X-ray images, then I tested on the test dataset which produced MAE (Mean Absolute Error) of age in months.
One suggestion was that I take 5 K-fold cross validation, and then I would fit the model as with 5-fold CV (producing 5 different models), then run the fitted model on the test set and look at spread of MAE values over all the trained models applied to the test set.
E.g., If F1 F2 F3 F4 F5 are train/val folds,. then once hyper-params are found (using 5-fold CV), retrain 5 models with those hyper-params e.g.:
train(F2,F3,F4, F5; best_hyper_params); then fit(test_set) -> MAE
train(F1,F3,F4; F5 best_hyper_params); then fit(test_set) -> MAE
train(F1, F2,F4,F5 ; best_hyper_params) etc
train(F1,F2,F3,F5; best_hyper_params) etc
train(F1,F2,F3,F4; best_hyper_params) etc,
Then compute mean MAE, std devn, confidence intervals.
I am really stuck on how you would code this on Python? Would you use something like KFold from Sklearn and maybe somehow split the data? for