def fit(self, X, y, sample_weight=None):
        """Fit the model according to the given training data.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_timestamps)
            Training vector.

        y : array-like, shape = (n_samples,)
            Class labels for each data sample.

        sample_weight : None or array-like, shape = (n_samples,) (default = None)
            Array of weights that are assigned to individual samples.
            If not provided, then each sample is given unit weight.

        Returns
        -------
        self : object

        """  # noqa: E501
        X, y = check_X_y(X, y)
        n_classes = len(LabelEncoder().fit(y).classes_)
        multi_class = self._check_params(n_classes)
        params = self.get_params()
        params.pop('n_jobs', None)
        params.pop('multi_class')
        clf = CrossEntropyLearningShapelets(**params)
        if multi_class == 'ovr':
            clf = OneVsRestClassifier(clf, n_jobs=self.n_jobs)
        elif multi_class == 'ovo':
            clf = OneVsOneClassifier(clf, n_jobs=self.n_jobs)
        clf.fit(X, y)

        self.classes_ = clf.classes_
        self._multi_class = multi_class

        if multi_class in ('ovr', 'ovo'):
            self._estimators = clf.estimators_
            self.shapelets_ = np.array(
                [est.shapelets_ for est in clf.estimators_])
            self.coef_ = np.squeeze(np.asarray(
                [est.coef_ for est in clf.estimators_]))
            self.intercept_ = np.squeeze(np.array(
                [est.intercept_ for est in clf.estimators_]))
            self.n_iter_ = np.array(
                [est.n_iter_ for est in clf.estimators_])
        else:
            self._clf = clf
            self.shapelets_ = np.array([clf.shapelets_])
            self.coef_ = clf.coef_
            self.intercept_ = clf.intercept_
            self.n_iter_ = np.array([clf.n_iter_])
        return self
Fit the model according to the given training data.

        Parameters
        ----------
        X : array-like, shape = (n_samples, n_timestamps)
            Training vector.

        y : array-like, shape = (n_samples,)
            Class labels for each data sample.

        sample_weight : None or array-like, shape = (n_samples,) (default = None)
            Array of weights that are assigned to individual samples.
            If not provided, then each sample is given unit weight.

        Returns
        -------
        self : object

        
pyts/classification/learning_shapelets.py