def fit(self, X, y, init_weights=True):
        """Learn weight coefficients from training data.

        Parameters
        ----------
        X : {array-like, sparse matrix}, shape = [n_samples, n_features]
            Training vectors, where n_samples is the number of samples and
            n_features is the number of features.
        y : array-like, shape = [n_samples]
            Target values.
        init_weights : bool (default: True)
            Re-initializes weights prior to fitting. Set False to continue
            training with weights from a previous fitting.

        Returns
        -------
        self : object

        """
        self._check_arrays(X, y)

        # check if {0, 1} or {-1, 1} class labels are used
        self.classes_ = np.unique(y)
        if not len(self.classes_) == 2 \
                or not self.classes_[0] in (-1, 0) \
                or not self.classes_[1] == 1:
            raise ValueError('Only supports binary class'
                             ' labels {0, 1} or {-1, 1}.')
        if self.classes_[0] == -1:
            self.thres_ = 0.0
        else:
            self.thres_ = 0.5

        if init_weights:
            self.w_ = self._init_weights(
                shape=1 + X.shape[1],
                zero_init_weight=self.zero_init_weight,
                seed=self.random_seed)

        self.cost_ = []

        # random seed for shuffling
        if self.random_seed:
            np.random.seed(self.random_seed)

        if self.minibatches is None:
            self.w_ = self._normal_equation(X, y)

        # Gradient descent or stochastic gradient descent learning
        else:
            n_idx = list(range(y.shape[0]))
            # skip shuffling if gradient descent
            if 1 > self.minibatches:
                n_idx = np.random.permutation(n_idx)
            self.init_time_ = time()
            for i in range(self.epochs):
                minis = np.array_split(n_idx, self.minibatches)
                for idx in minis:
                    y_val = self._activation(X[idx])
                    errors = (y[idx] - y_val)
                    self.w_[1:] += self.eta * X[idx].T.dot(errors)
                    self.w_[0] += self.eta * errors.sum()

                cost = self._sum_squared_error_cost(y, self._activation(X))
                self.cost_.append(cost)
                if self.print_progress:
                    self._print_progress(epoch=i + 1, cost=cost)

        return self
dataset/ETHPy150Open rasbt/mlxtend/mlxtend/classifier/adaline.py/Adaline.fit/swapped operands of `>`