StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
554 B
26 lines
554 B
'use strict'
|
|
|
|
module.exports = normalize;
|
|
|
|
function normalize (arr, dim) {
|
|
if (!arr || arr.length == null) throw Error('Argument should be an array')
|
|
|
|
if (dim == null) dim = 1
|
|
else dim = Math.floor(dim)
|
|
|
|
var bounds = Array(dim * 2)
|
|
|
|
for (var offset = 0; offset < dim; offset++) {
|
|
var max = -Infinity, min = Infinity, i = offset, l = arr.length;
|
|
|
|
for (; i < l; i+=dim) {
|
|
if (arr[i] > max) max = arr[i];
|
|
if (arr[i] < min) min = arr[i];
|
|
}
|
|
|
|
bounds[offset] = min
|
|
bounds[dim + offset] = max
|
|
}
|
|
|
|
return bounds;
|
|
}
|
|
|