def update(self, idxs, x):
# Fetch the classes for the regression
_, y = self.dataset.train_data[idxs]
# If we are doing the regression in logspace
if self.log:
x = np.log(x)
# Train the lstm so that it can predict x given the history
self.model.train_on_batch([self.history[idxs], self._to_ids(y)], x)
# Update the history to include x
full = idxs[self.cnts[idxs] == self.history.shape[1]]
self.history[full] = np.roll(self.history[full], -1, axis=1)
self.cnts[full] -= 1
self.history[idxs, self.cnts[idxs], :1] = x
self.cnts[idxs] += 1
评论列表
文章目录