Bugfix: Create 1 model per-gateway

This commit is contained in:
Starbeamrainbowlabs 2019-07-23 15:14:50 +01:00
parent 225eb8753a
commit f0694de02c
1 changed files with 4 additions and 4 deletions

View File

@ -12,8 +12,6 @@ class AITrainer {
this.l = log;
this.dataset_fetcher = DatasetFetcher;
this.repo_gateway = GatewayRepo;
this.model = this.generate_model();
}
generate_model() {
@ -78,6 +76,8 @@ class AITrainer {
* @return {Promise} A promise that resolves when training and serialisation is complete.
*/
async train_gateway(gateway_id, destination_filename) {
let model = this.generate_model();
// TODO: Add samples here for locations that the gateway does NOT cover too
let dataset_input = tf.data.generator(
this.dataset_fetcher.fetch_input.bind(this.dataset_fetcher, gateway_id)
@ -93,12 +93,12 @@ class AITrainer {
.batch(this.settings.ai.batch_size);
let result = await this.model.fitDataset(dataset, {
let result = await model.fitDataset(dataset, {
epochs: this.settings.ai.epochs,
batchSize: this.settings.ai.batch_size
});
await this.model.save(`file://${destination_filename}`);
await model.save(`file://${destination_filename}`);
console.log(result);
return true;