invert4geom.Inversion.optimize_inversion_zref_density_contrast_kfolds#
- Inversion.optimize_inversion_zref_density_contrast_kfolds(constraints_df, split_kwargs=None, **kwargs)[source]#
Perform an optimization for zref and density contrast values same as function optimize_inversion_zref_density_contrast, but pass a dataframe of constraint points and split_kwargs which are both passed split_test_train create K-folds of testing and training constraints. For each set of zref/density values, regional separation and inversion are performed for each of the K-folds in the constraints dataframe. The score for each parameter set will be the mean of the K-folds scores. This then repeats for all parameters. Within each parameter set and fold, the training constraints are used for the regional separation and the testing constraints are used for scoring. This optimization performs a total number of inversions equal to K-folds * number of parameter sets. For 20 parameter sets and 5 K-folds, this is 100 inversions. This extra computational expense is only useful if the regional separation technique you supply via regional_grav_kwargs uses constraints points for the estimations, such as constraint point minimization (method=’constraints_cv’ or method=’constraints’). It is more efficient, but less accurate, to simple use a different regional estimation technique, which doesn’t require constraint points, to find the optimal zref and density values. Then use these again in another inversion with the desired regional separation technique. Using the regional method of “constraints” will simply use the training points and supplied grid_method parameter values to calculate a regional field. Using the regional method of “constraints_cv” will take the training points and split these into a secondary set of training and testing points. These will be used internally in the regional separation to find the optimal grid_method parameters.
- Parameters:
constraints_df (
DataFrame) – constraints dataframe with columns “easting”, “northing”, and “upward”.split_kwargs (
dict[str,Any] |None) – kwargs to be passed to split_test_train for splitting constraints_df into test and train sets, by default None**kwargs (
Any) – kwargs to be passed to optimize_inversion_zref_density_contrast
- Returns:
Inversion object with best inversion results and the optimally determined zref and or density contrast values as attributes of the model attribute.
- Return type: