stacked_ensemble_classifier ========================================================================== .. py:module:: evalml.pipelines.components.ensemble.stacked_ensemble_classifier .. autoapi-nested-parse:: Stacked Ensemble Classifier. Module Contents --------------- Classes Summary ~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier Contents ~~~~~~~~~~~~~~~~~~~ .. py:class:: StackedEnsembleClassifier(final_estimator=None, n_jobs=-1, random_seed=0, **kwargs) Stacked Ensemble Classifier. :param final_estimator: The classifier used to combine the base estimators. If None, uses ElasticNetClassifier. :type final_estimator: Estimator or subclass :param n_jobs: Integer describing level of parallelism used for pipelines. None and 1 are equivalent. If set to -1, all CPUs are used. For n_jobs below -1, (n_cpus + 1 + n_jobs) are used. Defaults to -1. - Note: there could be some multi-process errors thrown for values of `n_jobs != 1`. If this is the case, please use `n_jobs = 1`. :type n_jobs: int or None :param random_seed: Seed for the random number generator. Defaults to 0. :type random_seed: int .. rubric:: Example >>> from evalml.pipelines.component_graph import ComponentGraph >>> from evalml.pipelines.components.estimators.classifiers.decision_tree_classifier import DecisionTreeClassifier >>> from evalml.pipelines.components.estimators.classifiers.elasticnet_classifier import ElasticNetClassifier ... >>> component_graph = { ... "Decision Tree": [DecisionTreeClassifier(random_seed=3), "X", "y"], ... "Decision Tree B": [DecisionTreeClassifier(random_seed=4), "X", "y"], ... "Stacked Ensemble": [ ... StackedEnsembleClassifier(n_jobs=1, final_estimator=DecisionTreeClassifier()), ... "Decision Tree.x", ... "Decision Tree B.x", ... "y", ... ], ... } ... >>> cg = ComponentGraph(component_graph) >>> assert cg.default_parameters == { ... 'Decision Tree Classifier': {'criterion': 'gini', ... 'max_features': 'auto', ... 'max_depth': 6, ... 'min_samples_split': 2, ... 'min_weight_fraction_leaf': 0.0}, ... 'Stacked Ensemble Classifier': {'final_estimator': ElasticNetClassifier, ... 'n_jobs': -1}} **Attributes** .. list-table:: :widths: 15 85 :header-rows: 0 * - **hyperparameter_ranges** - {} * - **model_family** - ModelFamily.ENSEMBLE * - **modifies_features** - True * - **modifies_target** - False * - **name** - Stacked Ensemble Classifier * - **supported_problem_types** - [ ProblemTypes.BINARY, ProblemTypes.MULTICLASS, ProblemTypes.TIME_SERIES_BINARY, ProblemTypes.TIME_SERIES_MULTICLASS,] * - **training_only** - False **Methods** .. autoapisummary:: :nosignatures: evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.clone evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.default_parameters evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.describe evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.feature_importance evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.fit evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.load evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.needs_fitting evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.parameters evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.predict evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.predict_proba evalml.pipelines.components.ensemble.stacked_ensemble_classifier.StackedEnsembleClassifier.save .. py:method:: clone(self) Constructs a new component with the same parameters and random state. :returns: A new instance of this component with identical parameters and random state. .. py:method:: default_parameters(cls) Returns the default parameters for stacked ensemble classes. :returns: default parameters for this component. :rtype: dict .. py:method:: describe(self, print_name=False, return_dict=False) Describe a component and its parameters. :param print_name: whether to print name of component :type print_name: bool, optional :param return_dict: whether to return description as dictionary in the format {"name": name, "parameters": parameters} :type return_dict: bool, optional :returns: Returns dictionary if return_dict is True, else None. :rtype: None or dict .. py:method:: feature_importance(self) :property: Not implemented for StackedEnsembleClassifier and StackedEnsembleRegressor. .. py:method:: fit(self, X, y=None) Fits estimator to data. :param X: The input training data of shape [n_samples, n_features]. :type X: pd.DataFrame :param y: The target training data of length [n_samples]. :type y: pd.Series, optional :returns: self .. py:method:: load(file_path) :staticmethod: Loads component at file path. :param file_path: Location to load file. :type file_path: str :returns: ComponentBase object .. py:method:: needs_fitting(self) Returns boolean determining if component needs fitting before calling predict, predict_proba, transform, or feature_importances. This can be overridden to False for components that do not need to be fit or whose fit methods do nothing. :returns: True. .. py:method:: parameters(self) :property: Returns the parameters which were used to initialize the component. .. py:method:: predict(self, X) Make predictions using selected features. :param X: Data of shape [n_samples, n_features]. :type X: pd.DataFrame :returns: Predicted values. :rtype: pd.Series :raises MethodPropertyNotFoundError: If estimator does not have a predict method or a component_obj that implements predict. .. py:method:: predict_proba(self, X) Make probability estimates for labels. :param X: Features. :type X: pd.DataFrame :returns: Probability estimates. :rtype: pd.Series :raises MethodPropertyNotFoundError: If estimator does not have a predict_proba method or a component_obj that implements predict_proba. .. py:method:: save(self, file_path, pickle_protocol=cloudpickle.DEFAULT_PROTOCOL) Saves component at file path. :param file_path: Location to save file. :type file_path: str :param pickle_protocol: The pickle data stream format. :type pickle_protocol: int