ml_grid.util.validate_parameters
Functions to validate model-specific hyperparameters before grid search.
Functions
|
Validates the n_neighbors parameter for KNN classifiers. |
|
Validates the max_bin parameter for XGBoost. |
|
Dispatches to the correct parameter validation function based on algorithm type. |
Module Contents
- ml_grid.util.validate_parameters.validate_knn_parameters(parameters: Dict[str, Any], ml_grid_object: Any) Dict[str, Any] [source]
Validates the n_neighbors parameter for KNN classifiers.
This function ensures that the values for n_neighbors do not exceed the number of samples in the training data. If a value is too large, it is capped at n_samples - 1.
- ml_grid.util.validate_parameters.validate_XGB_parameters(parameters: Dict[str, Any], ml_grid_object: Any) Dict[str, Any] [source]
Validates the max_bin parameter for XGBoost.
This function checks that the max_bin values are greater than or equal to 2, and if not, it sets them to 2.
- ml_grid.util.validate_parameters.validate_parameters_helper(algorithm_implementation: Any, parameters: Dict[str, Any], ml_grid_object: Any) Dict[str, Any] [source]
Dispatches to the correct parameter validation function based on algorithm type.
- Parameters:
algorithm_implementation (Any) – The scikit-learn estimator instance.
parameters (Dict[str, Any]) – The dictionary of parameters to validate.
ml_grid_object (Any) – The main pipeline object containing training data.
- Returns:
The validated parameters dictionary.
- Return type:
Dict[str, Any]