
    ,YHhd                         d dl mZmZ d dlZddlmZ ddlmZmZ dgZ	 G d deeej                        Z G d	 d
      Zy)    )BaseEstimatorTransformerMixinN   )DTYPE)
check_exogcheck_endogBaseTransformerc                   p    e Zd ZdZed        ZddZej                  d        Z	ej                  d        Z
y)r	   a  A base pre-processing transformer

    A subclass of the scikit-learn ``TransformerMixin``, the purpose of the
    ``BaseTransformer`` is to learn characteristics from the training set and
    apply them in a transformation to the test set. For instance, a transformer
    aimed at normalizing features in an exogenous array would learn the means
    and standard deviations of the training features in the ``fit`` method, and
    then center and scale the features in the ``transform`` method.

    The ``fit`` method should only ever be applied to the *training* set to
    avoid any data leakage, while ``transform`` may be applied to any dataset
    of the same schema.
    c                 X    | t        | t        ddd      } |t        |ddd      }| |fS )zValidate inputNTF)dtypecopyforce_all_finitepreserve_series)r   r   r   )r   r   r   )yXs     T/var/www/html/planif/env/lib/python3.12/site-packages/pmdarima/preprocessing/base.py
_check_y_XzBaseTransformer._check_y_X   sJ     =!& %A =!&	A !t    Nc                 N    | j                  ||        | j                  ||fi |S )a  Fit and transform the arrays

        Parameters
        ----------
        y : array-like or None, shape=(n_samples,)
            The endogenous (time-series) array.

        X : array-like or None, shape=(n_samples, n_features), optional
            The exogenous array of additional covariates.

        **kwargs : keyword args
            Keyword arguments required by the transform function.
        )fit	transformselfr   r   kwargss       r   fit_transformzBaseTransformer.fit_transform5   s)     	At~~a-f--r   c                      y)ao  Fit the transformer

        The purpose of the ``fit`` method is to learn a set of statistics or
        characteristics from the training set, and store them as "fit
        attributes" within the instance. A transformer *must* be fit before
        the transformation can be applied to a dataset in the ``transform``
        method.

        Parameters
        ----------
        y : array-like or None, shape=(n_samples,)
            The endogenous (time-series) array.

        X : array-like or None, shape=(n_samples, n_features)
            The exogenous array of additional covariates.

        Returns
        -------
        self : BaseTransformer
            The scikit-learn convention is for the ``fit`` method to return
            the instance of the transformer, ``self``. This allows us to
            string ``fit(...).transform(...)`` calls together.
        N )r   r   r   s      r   r   zBaseTransformer.fitF       r   c                      y)a  Transform the new array

        Apply the transformation to the array after learning the training set's
        characteristics in the ``fit`` method.

        Parameters
        ----------
        y : array-like or None, shape=(n_samples,)
            The endogenous (time-series) array.

        X : array-like or None, shape=(n_samples, n_features)
            The exogenous array of additional covariates.

        **kwargs : keyword args
            Keyword arguments required by the transform function.

        Returns
        -------
        y : array-like or None
            The transformed y array

        X : array-like or None
            The transformed X array
        Nr   r   s       r   r   zBaseTransformer.transform`   r   r   N)__name__
__module____qualname____doc__staticmethodr   r   abcabstractmethodr   r   r   r   r   r	   r	      sT      *." 	 2 	 r   )	metaclassc                       e Zd ZdZd ZddZy)UpdatableMixinz6Transformers that may update their params, like ARIMAsc                     |t        d      y )Nz(endog array cannot be None when updating)
ValueError)r   r   s     r   _check_endogzUpdatableMixin._check_endog   s    9GHH r   Nc                      y)a  Update the params and return the transformed arrays

        Parameters
        ----------
        y : array-like or None, shape=(n_samples,)
            The endogenous (time-series) array.

        X : array-like or None, shape=(n_samples, n_features)
            The exogenous array of additional covariates.

        **kwargs : keyword args
            Keyword arguments required by the transform function.
        Nr   r   s       r   update_and_transformz#UpdatableMixin.update_and_transform   r   r   r    )r!   r"   r#   r$   r-   r/   r   r   r   r*   r*   |   s    @Ir   r*   )sklearn.baser   r   r&   compat.numpyr   utilsr   r   __all__ABCMetar	   r*   r   r   r   <module>r5      sA    9 
   + 
hm%5 hV r   