Skip to content

Commit 5a84ec5

Browse files
committed
moved param descriptions to params and out of doc string
1 parent 43c0541 commit 5a84ec5

1 file changed

Lines changed: 16 additions & 43 deletions

File tree

ml_grid/util/global_params.py

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -38,73 +38,46 @@ class GlobalParameters:
3838
of the application. To change a parameter, access the singleton instance
3939
`global_parameters` and set the attribute directly, or use the
4040
`update_parameters` method.
41-
41+
4242
Example:
4343
from ml_grid.util.global_params import global_parameters
4444
global_parameters.verbose = 2
4545
global_parameters.update_parameters(bayessearch=False, random_grid_search=True)
46-
47-
Attributes:
48-
debug_level (int): The verbosity level for debugging. Not widely used.
49-
Defaults to 0.
50-
knn_n_jobs (int): The number of parallel jobs to run for KNN algorithms.
51-
-1 means using all available processors. Defaults to -1.
52-
verbose (int): Controls the verbosity of output during the pipeline run.
53-
Higher values produce more detailed logs. Defaults to 0.
54-
rename_cols (bool): If True, renames DataFrame columns to remove special
55-
characters (e.g., '[, ], <') that can cause issues with some models
56-
like XGBoost. Defaults to True.
57-
error_raise (bool): If True, the pipeline will stop and raise an
58-
exception if an error occurs during model training or evaluation.
59-
If False, it will log the error and continue. Defaults to False.
60-
random_grid_search (bool): If True and `bayessearch` is False, uses
61-
`RandomizedSearchCV` instead of `GridSearchCV`. Defaults to False.
62-
bayessearch (bool): If True, uses `BayesSearchCV` from `scikit-optimize`
63-
for hyperparameter tuning, which can be more efficient than grid
64-
or random search. Defaults to True.
65-
sub_sample_param_space_pct (float): The percentage of the total parameter
66-
space to sample when using `RandomizedSearchCV`. For example, 0.1
67-
means 10% of the combinations will be tried. Defaults to 0.0005.
68-
grid_n_jobs (int): The number of jobs to run in parallel for
69-
hyperparameter search (`GridSearchCV`, `RandomizedSearchCV`,
70-
`BayesSearchCV`). -1 means using all available processors.
71-
Defaults to -1.
72-
time_limit_param (list): A parameter for future use, intended to set
73-
time limits on model fitting. Currently not implemented.
74-
Defaults to [3].
75-
random_state_val (int): A seed value for random number generation to
76-
ensure reproducibility across runs. Defaults to 1234.
77-
n_jobs_model_val (int): The number of parallel jobs for models that
78-
support it (e.g., RandomForest). -1 means using all available
79-
processors. Defaults to -1.
80-
max_param_space_iter_value (int): A hard limit on the number of
81-
parameter combinations to evaluate in `RandomizedSearchCV` or
82-
`BayesSearchCV`. Prevents excessively long run times.
83-
Defaults to 10.
84-
store_models (bool): Whether to save trained models to disk.
85-
metric_list (Dict[str, Union[str, Callable]]): A dictionary of scoring
86-
metrics to evaluate models during cross-validation. Keys are metric
87-
names and values are scikit-learn scorer strings or callable objects.
8846
"""
8947

9048
_instance = None
9149

9250
# Class attributes with type hints
9351
debug_level: int
52+
"""The verbosity level for debugging. Not widely used. Defaults to 0."""
9453
knn_n_jobs: int
54+
"""The number of parallel jobs to run for KNN algorithms. -1 means using all available processors. Defaults to -1."""
9555
verbose: int
56+
"""Controls the verbosity of output during the pipeline run. Higher values produce more detailed logs. Defaults to 0."""
9657
rename_cols: bool
58+
"""If True, renames DataFrame columns to remove special characters (e.g., '[, ], <') that can cause issues with some models like XGBoost. Defaults to True."""
9759
error_raise: bool
60+
"""If True, the pipeline will stop and raise an exception if an error occurs during model training or evaluation. If False, it will log the error and continue. Defaults to False."""
9861
random_grid_search: bool
62+
"""If True and `bayessearch` is False, uses `RandomizedSearchCV` instead of `GridSearchCV`. Defaults to False."""
9963
bayessearch: bool
64+
"""If True, uses `BayesSearchCV` from `scikit-optimize` for hyperparameter tuning, which can be more efficient than grid or random search. Defaults to True."""
10065
sub_sample_param_space_pct: float
66+
"""The percentage of the total parameter space to sample when using `RandomizedSearchCV`. For example, 0.1 means 10% of the combinations will be tried. Defaults to 0.0005."""
10167
grid_n_jobs: int
68+
"""The number of jobs to run in parallel for hyperparameter search (`GridSearchCV`, `RandomizedSearchCV`, `BayesSearchCV`). -1 means using all available processors. Defaults to -1."""
10269
time_limit_param: List[int]
70+
"""A parameter for future use, intended to set time limits on model fitting. Currently not implemented. Defaults to [3]."""
10371
random_state_val: int
72+
"""A seed value for random number generation to ensure reproducibility across runs. Defaults to 1234."""
10473
n_jobs_model_val: int
74+
"""The number of parallel jobs for models that support it (e.g., RandomForest). -1 means using all available processors. Defaults to -1."""
10575
max_param_space_iter_value: int
76+
"""A hard limit on the number of parameter combinations to evaluate in `RandomizedSearchCV` or `BayesSearchCV`. Prevents excessively long run times. Defaults to 10."""
10677
store_models: bool
78+
"""Whether to save trained models to disk. Defaults to True."""
10779
metric_list: Dict[str, Union[str, Callable]]
80+
"""A dictionary of scoring metrics to evaluate models during cross-validation. Keys are metric names and values are scikit-learn scorer strings or callable objects."""
10881

10982
def __new__(cls, *args: Any, **kwargs: Any) -> "GlobalParameters":
11083
"""Creates a new instance if one does not already exist (Singleton pattern)."""

0 commit comments

Comments
 (0)