(self,features)
| 82 | self.w[j] -= self.learning_step * derivatives[j] |
| 83 | |
| 84 | def predict(self,features): |
| 85 | labels = [] |
| 86 | for feature in features: |
| 87 | x = list(feature) |
| 88 | x.append(1) |
| 89 | |
| 90 | x = np.matrix(x) |
| 91 | x = np.transpose(x) |
| 92 | |
| 93 | labels.append(self.predict_(x)) |
| 94 | return labels |
| 95 | |
| 96 | |
| 97 | if __name__ == '__main__': |