(self, x, y, window_size, learning_rate)
| 229 | # end-snippet-7 |
| 230 | |
| 231 | def train(self, x, y, window_size, learning_rate): |
| 232 | |
| 233 | cwords = contextwin(x, window_size) |
| 234 | words = list(map(lambda x: numpy.asarray(x).astype('int32'), cwords)) |
| 235 | labels = y |
| 236 | |
| 237 | self.sentence_train(words, labels, learning_rate) |
| 238 | self.normalize() |
| 239 | |
| 240 | def save(self, folder): |
| 241 | for param in self.params: |