def transform(self, X):
        """Derive word frequencies for each time series.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_timestamps)
            Data to transform.

        Returns
        -------
        X_new : array, shape = (n_samples, n_words)
            Word frequencies.

        """
        X = check_array(X, dtype='float64')
        check_is_fitted(self, 'vocabulary_')

        # Transform each time series into a bag of words
        bow = BagOfWords(
            window_size=self.window_size, word_size=self.word_size,
            n_bins=self.n_bins, strategy=self.strategy,
            numerosity_reduction=self.numerosity_reduction,
            window_step=self.window_step, norm_mean=self.norm_mean,
            norm_std=self.norm_std, overlapping=self.overlapping,
            alphabet=self.alphabet
        )
        X_bow = bow.transform(X)

        # Derive frequencies for each word in the vocabulary
        X_bop = self._vectorizer.transform(X_bow)
        if not self.sparse:
            return X_bop.A
        return csr_matrix(X_bop)
Derive word frequencies for each time series.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_timestamps)
            Data to transform.

        Returns
        -------
        X_new : array, shape = (n_samples, n_words)
            Word frequencies.

        
pyts/transformation/bag_of_patterns.py