component_base ==================================================== .. py:module:: evalml.pipelines.components.component_base .. autoapi-nested-parse:: Base class for all components. Module Contents --------------- Classes Summary ~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.pipelines.components.component_base.ComponentBase Contents ~~~~~~~~~~~~~~~~~~~ .. py:class:: ComponentBase(parameters=None, component_obj=None, random_seed=0, **kwargs) Base class for all components. :param parameters: Dictionary of parameters for the component. Defaults to None. :type parameters: dict :param component_obj: Third-party objects useful in component implementation. Defaults to None. :type component_obj: obj :param random_seed: Seed for the random number generator. Defaults to 0. :type random_seed: int **Methods** .. autoapisummary:: :nosignatures: evalml.pipelines.components.component_base.ComponentBase.clone evalml.pipelines.components.component_base.ComponentBase.default_parameters evalml.pipelines.components.component_base.ComponentBase.describe evalml.pipelines.components.component_base.ComponentBase.fit evalml.pipelines.components.component_base.ComponentBase.load evalml.pipelines.components.component_base.ComponentBase.modifies_features evalml.pipelines.components.component_base.ComponentBase.modifies_target evalml.pipelines.components.component_base.ComponentBase.name evalml.pipelines.components.component_base.ComponentBase.needs_fitting evalml.pipelines.components.component_base.ComponentBase.parameters evalml.pipelines.components.component_base.ComponentBase.save evalml.pipelines.components.component_base.ComponentBase.training_only .. 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 this component. Our convention is that Component.default_parameters == Component().parameters. :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:: fit(self, X, y=None) Fits component 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 :raises MethodPropertyNotFoundError: If component does not have a fit method or a component_obj that implements fit. .. 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:: modifies_features(cls) :property: Returns whether this component modifies (subsets or transforms) the features variable during transform. For Estimator objects, this attribute determines if the return value from `predict` or `predict_proba` should be used as features or targets. .. py:method:: modifies_target(cls) :property: Returns whether this component modifies (subsets or transforms) the target variable during transform. For Estimator objects, this attribute determines if the return value from `predict` or `predict_proba` should be used as features or targets. .. py:method:: name(cls) :property: Returns string name of this component. .. 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:: 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 .. py:method:: training_only(cls) :property: Returns whether or not this component should be evaluated during training-time only, or during both training and prediction time.