def fit(self, X, y=None):
        """ A reference implementation of a fitting function.

        Parameters
        ----------
        X : array-like, pandas DataFrame or Series, shape (n_samples, ...)
            The training input samples.
        y : None, as it is transformer on X

        Returns
        -------
        self : object
            Returns self.
        """

        # check the validity of input
        X = check_ts_array(X)
        if not X.shape[1] == len(self.funcs):
            raise ValueError(
                "No. of columns and No. of functions supplied to transformer dont match"
            )

        # fitting - this transformer needs no fitting
        pass

        # let the model know that it is fitted
        self.is_fitted_ = True
        # `fit` should always return `self`
        return self
    def fit(self, X, y=None):
        """ A reference implementation of a fitting function.

        Parameters
        ----------
        X : array-like, pandas DataFrame or Series, shape (n_samples, ...)
            The training input samples.
        y : None, as it is transformer on X

        Returns
        -------
        self : object
            Returns self.
        """

        # check the validity of input
        X = check_ts_array(X)

        # fitting - this transformer needs no fitting
        pass

        # let the model know that it is fitted
        self.is_fitted_ = True
        # `fit` should always return `self`
        return self
Example #3
0
    def predict(self, X):
        """ A reference implementation of a predicting function.

        Parameters
        ----------
        X : array-like, pandas DataFrame or Series, shape (n_samples, ...)
            The training input samples.
        Returns
        -------
        y : ndarray, shape (n_samples,)
            Returns the dummy predictions
        """
        X = check_ts_array(X)
        check_is_fitted(self, 'is_fitted_')
        return np.ones(X.shape[0], dtype=np.int64) * self.theta_
Example #4
0
    def predict(self, X):
        """ A reference implementation of a predicting function.

        Parameters
        ----------
        X : array-like, pandas DataFrame or Series, shape (n_samples, ...)
            The training input samples.
        Returns
        -------
        y : ndarray, shape (n_samples,)
            Returns the dummy predictions
        """
        X = pd.DataFrame([X[col].apply(self.func) for col in self.columns]).T

        X = check_ts_array(X)

        check_is_fitted(self, 'is_fitted_')

        return self.estimator.predict(X)
    def transform(self, X):
        """ A reference implementation of a predicting function.

        Parameters
        ----------
        X : array-like, pandas DataFrame or Series, shape (n_samples, ...)
            The training input samples.
        Returns
        -------
        T : array-like, pandas DataFrame or Series, shape (n_samples, ...)
            The transformed data
        """
        # check validity of input
        X = check_ts_array(X)
        check_is_fitted(self, 'is_fitted_')

        T = X

        return T