Fix more training and prediction bugs, but its still not working as intended.
This commit is contained in:
parent
7761b0e1aa
commit
f18023cf1a
4 changed files with 33 additions and 6 deletions
|
@ -83,10 +83,10 @@ class LayerAI {
|
||||||
this.colour_scale = chroma.scale([
|
this.colour_scale = chroma.scale([
|
||||||
Config.colour_scale.min,
|
Config.colour_scale.min,
|
||||||
Config.colour_scale.max
|
Config.colour_scale.max
|
||||||
]).domain(
|
]).domain([
|
||||||
this.index.properties.rssi_min,
|
this.index.properties.rssi_min,
|
||||||
this.index.properties.rssi_max
|
this.index.properties.rssi_max
|
||||||
);
|
]);
|
||||||
|
|
||||||
// Setup the web worker army
|
// Setup the web worker army
|
||||||
for(let i = 0; i < (navigator.hardwareConcurrency || 4); i++) {
|
for(let i = 0; i < (navigator.hardwareConcurrency || 4); i++) {
|
||||||
|
@ -150,7 +150,7 @@ class LayerAI {
|
||||||
|
|
||||||
this.workers.length = 0; // Empty the array of workers
|
this.workers.length = 0; // Empty the array of workers
|
||||||
|
|
||||||
console.log(this.stats);
|
console.log("Statistics:", this.stats);
|
||||||
|
|
||||||
return this.geojson;
|
return this.geojson;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,10 +84,10 @@ class AIWrapper {
|
||||||
next_value[0]
|
next_value[0]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let chance = Math.random() < 0.01;
|
// let chance = Math.random() < 0.01;
|
||||||
if(chance) console.log(max_predicted_rssi);
|
// if(chance) console.log(max_predicted_rssi);
|
||||||
max_predicted_rssi = unnormalise_rssi(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)
|
if(max_predicted_rssi > stats.rssi_max)
|
||||||
stats.rssi_max = max_predicted_rssi;
|
stats.rssi_max = max_predicted_rssi;
|
||||||
|
|
22
server/Helpers/FisherYates.mjs
Normal file
22
server/Helpers/FisherYates.mjs
Normal 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;
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
import haversine from 'haversine-distance';
|
import haversine from 'haversine-distance';
|
||||||
|
|
||||||
|
import shuffle_fisher_yates from '../Helpers/FisherYates.mjs';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
normalise_lat,
|
normalise_lat,
|
||||||
normalise_lng,
|
normalise_lng,
|
||||||
|
@ -48,8 +50,11 @@ class DatasetFetcher {
|
||||||
output: [ 0 ]
|
output: [ 0 ]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
shuffle_fisher_yates(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default DatasetFetcher;
|
export default DatasetFetcher;
|
||||||
|
|
Loading…
Reference in a new issue