Fix more training and prediction bugs, but its still not working as intended.

This commit is contained in:
Starbeamrainbowlabs 2019-07-30 18:56:45 +01:00
parent 7761b0e1aa
commit f18023cf1a
4 changed files with 33 additions and 6 deletions

View file

@ -83,10 +83,10 @@ class LayerAI {
this.colour_scale = chroma.scale([
Config.colour_scale.min,
Config.colour_scale.max
]).domain(
]).domain([
this.index.properties.rssi_min,
this.index.properties.rssi_max
);
]);
// Setup the web worker army
for(let i = 0; i < (navigator.hardwareConcurrency || 4); i++) {
@ -150,7 +150,7 @@ class LayerAI {
this.workers.length = 0; // Empty the array of workers
console.log(this.stats);
console.log("Statistics:", this.stats);
return this.geojson;
}

View file

@ -84,10 +84,10 @@ class AIWrapper {
next_value[0]
);
}
let chance = Math.random() < 0.01;
if(chance) console.log(max_predicted_rssi);
// let chance = Math.random() < 0.01;
// if(chance) console.log(max_predicted_rssi);
max_predicted_rssi = unnormalise_rssi(max_predicted_rssi);
if(chance) console.log(max_predicted_rssi);
// if(chance) console.log(max_predicted_rssi);
if(max_predicted_rssi > stats.rssi_max)
stats.rssi_max = max_predicted_rssi;

View file

@ -0,0 +1,22 @@
"use strict";
function shuffle_fisher_yates(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
export default shuffle_fisher_yates;

View file

@ -2,6 +2,8 @@
import haversine from 'haversine-distance';
import shuffle_fisher_yates from '../Helpers/FisherYates.mjs';
import {
normalise_lat,
normalise_lng,
@ -48,8 +50,11 @@ class DatasetFetcher {
output: [ 0 ]
});
}
shuffle_fisher_yates(result);
return result;
}
}
export default DatasetFetcher;