vastorbit.machine_learning.model_selection.hp_tuning.gen_params_grid¶
- vastorbit.machine_learning.model_selection.hp_tuning.gen_params_grid(estimator: VASTModel, nbins: int = 10, max_nfeatures: int = 3, lmax: int = -1, optimized_grid: int = 0) dict[str, Any]¶
Generates the estimator grid.
- Parameters:
estimator (object) – VAST estimator with a fit method.
nbins (int, optional) – Number of bins used to discretize numerical features.
max_nfeatures (int, optional) – Maximum number of features used to compute Random Forest, PCA…
lmax (int, optional) – Maximum length of the parameter grid.
optimized_grid (int, optional) – If set to 0, the randomness is based on the input parameters. If set to 1, the randomness is limited to some parameters while others are picked based on a default grid. If set to 2, there is no randomness and a default grid is returned.
- Returns:
Dictionary of parameters.
- Return type:
dict
Examples
Let’s take
LogisticRegressionas an example model:from vastorbit.machine_learning.vast import LogisticRegression model = LogisticRegression()
Now, we can find the parameter grid quite conveniently using:
from vastorbit.machine_learning.model_selection import gen_params_grid gen_params_grid(model, lmax = 10)
Note
The function automatically detects the parameters from any vastorbit model, and then creates a grid based on the generic value range.
See also
parameter_grid(): Generates alistof the different combinations of input parameters.