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.
22 lines
530 B
22 lines
530 B
/**
|
|
* Precision round
|
|
*
|
|
* @param {number} value
|
|
* @param {number} step Minimal discrete to round
|
|
*
|
|
* @return {number}
|
|
*
|
|
* @example
|
|
* toPrecision(213.34, 1) == 213
|
|
* toPrecision(213.34, .1) == 213.3
|
|
* toPrecision(213.34, 10) == 210
|
|
*/
|
|
'use strict';
|
|
var precision = require('./precision');
|
|
|
|
module.exports = function(value, step) {
|
|
if (step === 0) return value;
|
|
if (!step) return Math.round(value);
|
|
value = Math.round(value / step) * step;
|
|
return parseFloat(value.toFixed(precision(step)));
|
|
};
|
|
|