Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.memory.sample(this.config.batchSize).forEach((memento => {
let target = memento.reward;
if (!this.done) {
target = memento.reward + this.config.learningConfig.gamma * this.model.predict(memento.nextState).getHighestValue();
}
let future_target = this.model.predict(memento.state).getValue();
future_target[memento.action] = target;
this.model.fit(memento.state, tensor2d(future_target, [1, 3]), {epochs:1, verbose: ModelLoggingVerbosity.VERBOSE}).then((result) => this.lossesHistory.add(result.loss));
}));
}