ml_grid.pipeline.hyperparameter_search ====================================== .. py:module:: ml_grid.pipeline.hyperparameter_search Classes ------- .. autoapisummary:: ml_grid.pipeline.hyperparameter_search.HyperparameterSearch Module Contents --------------- .. py:class:: HyperparameterSearch(algorithm: sklearn.base.BaseEstimator, parameter_space: Union[Dict, List[Dict]], method_name: str, global_params: Any, sub_sample_pct: int = 100, max_iter: int = 100, ml_grid_object: Any = None) Initializes the HyperparameterSearch class. :param algorithm: The scikit-learn compatible estimator instance. :type algorithm: BaseEstimator :param parameter_space: The hyperparameter search space. :type parameter_space: Union[Dict, List[Dict]] :param method_name: The name of the algorithm. :type method_name: str :param global_params: The global parameters object. :type global_params: Any :param sub_sample_pct: Percentage of the parameter space to sample for randomized search. Defaults to 100. :type sub_sample_pct: int, optional :param max_iter: The maximum number of iterations for randomized or Bayesian search. Defaults to 100. :type max_iter: int, optional :param ml_grid_object: The main pipeline object containing data and other parameters. Defaults to None. :type ml_grid_object: Any, optional .. py:attribute:: algorithm :type: sklearn.base.BaseEstimator The scikit-learn compatible estimator instance. .. py:attribute:: parameter_space :type: Union[Dict, List[Dict]] The hyperparameter search space. .. py:attribute:: method_name :type: str The name of the algorithm. .. py:attribute:: global_params :type: ml_grid.util.global_params.global_parameters A reference to the global parameters singleton instance. .. py:attribute:: sub_sample_pct :type: int Percentage of the parameter space to sample for randomized search. Defaults to 100. .. py:attribute:: max_iter :type: int The maximum number of iterations for randomized or Bayesian search. Defaults to 100. .. py:attribute:: ml_grid_object :type: Any The main pipeline object containing data and other parameters. .. py:method:: run_search(X_train: pandas.DataFrame, y_train: pandas.Series) -> sklearn.base.BaseEstimator Executes the hyperparameter search. This method selects the search strategy (Grid, Random, or Bayesian) based on global parameters and runs the search on the provided training data. :param X_train: Training features. :type X_train: pd.DataFrame :param y_train: Training labels. :type y_train: pd.Series :returns: The best estimator found during the search. :rtype: BaseEstimator