def predict(self, x): _x = np.ones((x.shape[0], x.shape[1] + 1)) _x[:, : - 1] = x score = expit(np.inner(self.w, _x)) signs = np.sign(score - .5) return [0 if x == -1 else 1 for x in signs]