def fit(self, X, y=None):
        """Learn the dictionary.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_timestamps)
            Input data

        y
            Ignored

        Returns
        -------
        self : object

        """
        # 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)

        # Learn the vocabulary
        vectorizer = CountVectorizer()
        vectorizer.fit(X_bow)
        self.vocabulary_ = {value: key for key, value in
                            vectorizer.vocabulary_.items()}
        self._vectorizer = vectorizer
        return self
Learn the dictionary.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_timestamps)
            Input data

        y
            Ignored

        Returns
        -------
        self : object

        
pyts/transformation/bag_of_patterns.py