automl_algorithm ========================================================= .. py:module:: evalml.automl.automl_algorithm.automl_algorithm .. autoapi-nested-parse:: Base class for the AutoML algorithms which power EvalML. Module Contents --------------- Classes Summary ~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.automl.automl_algorithm.automl_algorithm.AutoMLAlgorithm Exceptions Summary ~~~~~~~~~~~~~~~~~~ .. autoapisummary:: `evalml.automl.automl_algorithm.automl_algorithm.AutoMLAlgorithmException` Contents ~~~~~~~~~~~~~~~~~~~ .. py:class:: AutoMLAlgorithm(allowed_pipelines=None, allowed_model_families=None, excluded_model_families=None, allowed_component_graphs=None, search_parameters=None, tuner_class=None, text_in_ensembling=False, random_seed=0, n_jobs=-1) Base class for the AutoML algorithms which power EvalML. This class represents an automated machine learning (AutoML) algorithm. It encapsulates the decision-making logic behind an automl search, by both deciding which pipelines to evaluate next and by deciding what set of parameters to configure the pipeline with. To use this interface, you must define a next_batch method which returns the next group of pipelines to evaluate on the training data. That method may access state and results recorded from the previous batches, although that information is not tracked in a general way in this base class. Overriding add_result is a convenient way to record pipeline evaluation info if necessary. :param allowed_pipelines: A list of PipelineBase subclasses indicating the pipelines allowed in the search. The default of None indicates all pipelines for this problem type are allowed. :type allowed_pipelines: list(class) :param search_parameters: Search parameter ranges specified for pipelines to iterate over. :type search_parameters: dict :param tuner_class: A subclass of Tuner, to be used to find parameters for each pipeline. The default of None indicates the SKOptTuner will be used. :type tuner_class: class :param text_in_ensembling: If True and ensembling is True, then n_jobs will be set to 1 to avoid downstream sklearn stacking issues related to nltk. Defaults to None. :type text_in_ensembling: boolean :param random_seed: Seed for the random number generator. Defaults to 0. :type random_seed: int **Methods** .. autoapisummary:: :nosignatures: evalml.automl.automl_algorithm.automl_algorithm.AutoMLAlgorithm.add_result evalml.automl.automl_algorithm.automl_algorithm.AutoMLAlgorithm.batch_number evalml.automl.automl_algorithm.automl_algorithm.AutoMLAlgorithm.default_max_batches evalml.automl.automl_algorithm.automl_algorithm.AutoMLAlgorithm.next_batch evalml.automl.automl_algorithm.automl_algorithm.AutoMLAlgorithm.num_pipelines_per_batch evalml.automl.automl_algorithm.automl_algorithm.AutoMLAlgorithm.pipeline_number .. py:method:: add_result(self, score_to_minimize, pipeline, trained_pipeline_results) Register results from evaluating a pipeline. :param score_to_minimize: The score obtained by this pipeline on the primary objective, converted so that lower values indicate better pipelines. :type score_to_minimize: float :param pipeline: The trained pipeline object which was used to compute the score. :type pipeline: PipelineBase :param trained_pipeline_results: Results from training a pipeline. :type trained_pipeline_results: dict :raises PipelineNotFoundError: If pipeline is not allowed in search. .. py:method:: batch_number(self) :property: Returns the number of batches which have been recommended so far. .. py:method:: default_max_batches(self) :property: Returns the number of max batches AutoMLSearch should run by default. .. py:method:: next_batch(self) :abstractmethod: Get the next batch of pipelines to evaluate. :returns: A list of instances of PipelineBase subclasses, ready to be trained and evaluated. :rtype: list[PipelineBase] .. py:method:: num_pipelines_per_batch(self, batch_number) :abstractmethod: Return the number of pipelines in the nth batch. :param batch_number: which batch to calculate the number of pipelines for. :type batch_number: int :returns: number of pipelines in the given batch. :rtype: int .. py:method:: pipeline_number(self) :property: Returns the number of pipelines which have been recommended so far. .. py:exception:: AutoMLAlgorithmException Exception raised when an error is encountered during the computation of the automl algorithm.