def fit(self, X, y):
        if self.verbose:
            print("[DBN] fitting X.shape=%s" % (X.shape,))
        self._enc = LabelEncoder()
        y = self._enc.fit_transform(y)
        y = self._onehot(y)

        self.net_ = self._build_net(X, y)

        minibatches_per_epoch = self.minibatches_per_epoch
        if minibatches_per_epoch is None:
            minibatches_per_epoch = X.shape[0] / self.minibatch_size

        loss_funct = self.loss_funct
        if loss_funct is None:
            loss_funct = self._num_mistakes

        errors_pretrain = self.errors_pretrain_ = []
        losses_fine_tune = self.losses_fine_tune_ = []
        errors_fine_tune = self.errors_fine_tune_ = []

        if self.epochs_pretrain:
            self.epochs_pretrain = self._vp(self.epochs_pretrain)
            self._configure_net_pretrain(self.net_)
            for layer_index in range(len(self.layer_sizes) - 1):
                errors_pretrain.append([])
                if self.verbose:  # pragma: no cover
                    print("[DBN] Pre-train layer {}...".format(layer_index + 1))
                time0 = time()
                for epoch, err in enumerate(
                    self.net_.preTrainIth(
                        layer_index,
                        self._minibatches(X),
                        self.epochs_pretrain[layer_index],
                        minibatches_per_epoch,
                        )):
                    errors_pretrain[-1].append(err)
                    if self.verbose:  # pragma: no cover
                        print("  Epoch {}: err {}".format(epoch + 1, err))
                        elapsed = str(timedelta(seconds=time() - time0))
                        print("  ({})".format(elapsed.split('.')[0]))
                        time0 = time()
                    if self.pretrain_callback is not None:
                        self.pretrain_callback(
                            self, epoch + 1, layer_index)

        self._configure_net_finetune(self.net_)
        if self.verbose:  # pragma: no cover
            print("[DBN] Fine-tune...")
        time0 = time()
        for epoch, (loss, err) in enumerate(
            self.net_.fineTune(
                self._minibatches(X, y),
                self.epochs,
                minibatches_per_epoch,
                loss_funct,
                self.verbose,
                self.use_dropout,
                )):
            losses_fine_tune.append(loss)
            errors_fine_tune.append(err)
            self._learn_rate_adjust()
            if self.verbose:  # pragma: no cover
                print("Epoch {}:".format(epoch + 1))
                print("  loss {}".format(loss))
                print("  err  {}".format(err))
                elapsed = str(timedelta(seconds=time0 - time()))
                print("  ({})".format(elapsed.split('.')[0]))
                time0 = time()
            if self.fine_tune_callback is not None:
                self.fine_tune_callback(self, epoch + 1)
dataset/ETHPy150Open dnouri/nolearn/nolearn/dbn.py/DBN.fit/swapped operands of `-`