pod.fit_robust_mean_model
fit_robust_mean_model(X, y, max_degree=10, n_folds=10)Fits regression models (Polynomials and Kriging) and selects the optimal one.
This function performs k-fold Cross Validation (CV) to find the model type (Polynomial or Kriging) and parameters (e.g., degree) that minimize the Mean Squared Error (MSE), balancing bias and variance.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| X | np.ndarray | 1D array of input variable values (e.g., flaw size). | required |
| y | np.ndarray | 1D array of outcome values (e.g., signal response). | required |
| max_degree | int | The maximum polynomial degree to test. Defaults to 10. | 10 |
| n_folds | int | Number of folds for Cross Validation. Defaults to 10. | 10 |
Returns
| Name | Type | Description |
|---|---|---|
| Any | Any | A fitted scikit-learn model with the following added attributes: |
| Any | - model_type_ (str): Either ‘Polynomial’ or ‘Kriging’. |
|
| Any | - model_params_ (Any): The selected integer degree or the fitted kernel. |
|
| Any | - cv_scores_ (dict): The cross-validation MSE scores for all tested models. |