grid_search_tuner ========================================= .. py:module:: evalml.tuners.grid_search_tuner .. autoapi-nested-parse:: Grid Search Optimizer, which generates all of the possible points to search for using a grid. Module Contents --------------- Classes Summary ~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.tuners.grid_search_tuner.GridSearchTuner Contents ~~~~~~~~~~~~~~~~~~~ .. py:class:: GridSearchTuner(pipeline_hyperparameter_ranges, n_points=10, random_seed=0) Grid Search Optimizer, which generates all of the possible points to search for using a grid. :param pipeline_hyperparameter_ranges: a set of hyperparameter ranges corresponding to a pipeline's parameters :type pipeline_hyperparameter_ranges: dict :param n_points: The number of points to sample from along each dimension defined in the ``space`` argument. Defaults to 10. :type n_points: int :param random_seed: Seed for random number generator. Unused in this class, defaults to 0. :type random_seed: int .. rubric:: Examples >>> tuner = GridSearchTuner({'My Component': {'param a': [0.0, 10.0], 'param b': ['a', 'b', 'c']}}, n_points=5) >>> proposal = tuner.propose() ... >>> assert proposal.keys() == {'My Component'} >>> assert proposal['My Component'] == {'param a': 0.0, 'param b': 'a'} Determines points using a grid search approach. >>> for each in range(5): ... print(tuner.propose()) {'My Component': {'param a': 0.0, 'param b': 'b'}} {'My Component': {'param a': 0.0, 'param b': 'c'}} {'My Component': {'param a': 10.0, 'param b': 'a'}} {'My Component': {'param a': 10.0, 'param b': 'b'}} {'My Component': {'param a': 10.0, 'param b': 'c'}} **Methods** .. autoapisummary:: :nosignatures: evalml.tuners.grid_search_tuner.GridSearchTuner.add evalml.tuners.grid_search_tuner.GridSearchTuner.get_starting_parameters evalml.tuners.grid_search_tuner.GridSearchTuner.is_search_space_exhausted evalml.tuners.grid_search_tuner.GridSearchTuner.propose .. py:method:: add(self, pipeline_parameters, score) Not applicable to grid search tuner as generated parameters are not dependent on scores of previous parameters. :param pipeline_parameters: a dict of the parameters used to evaluate a pipeline :type pipeline_parameters: dict :param score: the score obtained by evaluating the pipeline with the provided parameters :type score: float .. py:method:: get_starting_parameters(self, hyperparameter_ranges, random_seed=0) Gets the starting parameters given the pipeline hyperparameter range. :param hyperparameter_ranges: The custom hyperparameter ranges passed in during search. Used to determine the starting parameters. :type hyperparameter_ranges: dict :param random_seed: The random seed to use. Defaults to 0. :type random_seed: int :returns: The starting parameters, randomly chosen, to initialize a pipeline with. :rtype: dict .. py:method:: is_search_space_exhausted(self) Checks if it is possible to generate a set of valid parameters. Stores generated parameters in ``self.curr_params`` to be returned by ``propose()``. :returns: If no more valid parameters exists in the search space, return False. :rtype: bool :raises NoParamsException: If a search space is exhausted, then this exception is thrown. .. py:method:: propose(self) Returns parameters from _grid_points iterations. If all possible combinations of parameters have been scored, then ``NoParamsException`` is raised. :returns: proposed pipeline parameters :rtype: dict