invert4geom.Inversion.optimize_inversion_damping#
- Inversion.optimize_inversion_damping(n_trials, damping_limits, n_startup_trials=None, score_as_median=False, sampler=None, grid_search=False, fname=None, plot_scores=True, plot_cv=None, plot_grids=False, logx=True, logy=True, progressbar=True, parallel=False, seed=0)[source]#
Use Optuna to find the optimal damping regularization parameter for a gravity inversion. The optimization aims to minimize the cross-validation score, represented by the root mean (or median) squared error (RMSE), between the testing gravity data, and the predict gravity data after and inversion. Follows methods of Uieda and Barbosa[1].
Provide upper and low damping values, number of trials to run, and specify to let Optuna choose the best damping value for each trial or to use a grid search. The results are saved to a pickle file with the best inversion results and the study.
- Parameters:
n_trials (
int) â number of damping values to tryn_startup_trials (
int|None) â number of startup trials, by default is automatically determineddamping_limits (
tuple[float,float]) â upper and lower limitsscore_as_median (
bool) â if True, changes the scoring from the root mean square to the root median square, by default Falsesampler (
BaseSampler|None) â customize the optuna sampler, by default either GPsampler or GridSampler depending on if grid_search is True or Falsegrid_search (
bool) â search the entire parameter space between damping_limits in n_trial steps, by default Falsefname (
str|None) â file name to save both study and inversion results to as pickle files, by default fname is tmp_x_damping_cv where x is a random integer between 0 and 999 and will save study to <fname>_study.pickle and tuple of inversion results to <fname>.pickle.plot_scores (
bool) â plot the cross-validation results, by default Trueplot_grids (
bool) â for each damping value, plot comparison of predicted and testing gravity data, by default Falselogx (
bool) â make x axis of CV result plot on log scale, by default Truelogy (
bool) â make y axis of CV result plot on log scale, by default Trueprogressbar (
bool) â add a progressbar, by default Trueparallel (
bool) â run the optimization in parallel, by default Falseseed (
int) â random seed for the samplers, by default 0
- Returns:
inv_copy â a copy of the Inversion object after running the inversion with the best damping value
- Return type: