dimensionality_reduction =========================================================================== .. py:module:: evalml.pipelines.components.transformers.dimensionality_reduction .. autoapi-nested-parse:: Transformers that reduce the dimensionality of the input data. Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 lda/index.rst pca/index.rst Package Contents ---------------- Classes Summary ~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis evalml.pipelines.components.transformers.dimensionality_reduction.PCA Contents ~~~~~~~~~~~~~~~~~~~ .. py:class:: LinearDiscriminantAnalysis(n_components=None, random_seed=0, **kwargs) Reduces the number of features by using Linear Discriminant Analysis. :param n_components: The number of features to maintain after computation. Defaults to None. :type n_components: int :param random_seed: Seed for the random number generator. Defaults to 0. :type random_seed: int **Attributes** .. list-table:: :widths: 15 85 :header-rows: 0 * - **hyperparameter_ranges** - {} * - **modifies_features** - True * - **modifies_target** - False * - **name** - Linear Discriminant Analysis Transformer * - **training_only** - False **Methods** .. autoapisummary:: :nosignatures: evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.clone evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.default_parameters evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.describe evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.fit evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.fit_transform evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.load evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.needs_fitting evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.parameters evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.save evalml.pipelines.components.transformers.dimensionality_reduction.LinearDiscriminantAnalysis.transform .. 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) Fits the LDA component. :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 ValueError: If input data is not all numeric. .. py:method:: fit_transform(self, X, y=None) Fit and transform data using the LDA component. :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: Transformed data. :rtype: pd.DataFrame :raises ValueError: If input data is not all numeric. .. 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:: 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:: transform(self, X, y=None) Transform data using the fitted LDA component. :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: Transformed data. :rtype: pd.DataFrame :raises ValueError: If input data is not all numeric. .. py:class:: PCA(variance=0.95, n_components=None, random_seed=0, **kwargs) Reduces the number of features by using Principal Component Analysis (PCA). :param variance: The percentage of the original data variance that should be preserved when reducing the number of features. Defaults to 0.95. :type variance: float :param n_components: The number of features to maintain after computing SVD. Defaults to None, but will override variance variable if set. :type n_components: int :param random_seed: Seed for the random number generator. Defaults to 0. :type random_seed: int **Attributes** .. list-table:: :widths: 15 85 :header-rows: 0 * - **hyperparameter_ranges** - Real(0.25, 1)}:type: {"variance" * - **modifies_features** - True * - **modifies_target** - False * - **name** - PCA Transformer * - **training_only** - False **Methods** .. autoapisummary:: :nosignatures: evalml.pipelines.components.transformers.dimensionality_reduction.PCA.clone evalml.pipelines.components.transformers.dimensionality_reduction.PCA.default_parameters evalml.pipelines.components.transformers.dimensionality_reduction.PCA.describe evalml.pipelines.components.transformers.dimensionality_reduction.PCA.fit evalml.pipelines.components.transformers.dimensionality_reduction.PCA.fit_transform evalml.pipelines.components.transformers.dimensionality_reduction.PCA.load evalml.pipelines.components.transformers.dimensionality_reduction.PCA.needs_fitting evalml.pipelines.components.transformers.dimensionality_reduction.PCA.parameters evalml.pipelines.components.transformers.dimensionality_reduction.PCA.save evalml.pipelines.components.transformers.dimensionality_reduction.PCA.transform .. 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 the PCA component. :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 ValueError: If input data is not all numeric. .. py:method:: fit_transform(self, X, y=None) Fit and transform data using the PCA component. :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: Transformed data. :rtype: pd.DataFrame :raises ValueError: If input data is not all numeric. .. 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:: 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:: transform(self, X, y=None) Transform data using fitted PCA component. :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: Transformed data. :rtype: pd.DataFrame :raises ValueError: If input data is not all numeric.