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.
64 lines
1.5 KiB
64 lines
1.5 KiB
'use strict';
|
|
|
|
var callable, byObserver;
|
|
|
|
callable = function (fn) {
|
|
if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
|
|
return fn;
|
|
};
|
|
|
|
byObserver = function (Observer) {
|
|
var node = document.createTextNode(''), queue, i = 0;
|
|
new Observer(function () {
|
|
var data;
|
|
if (!queue) return;
|
|
data = queue;
|
|
queue = null;
|
|
if (typeof data === 'function') {
|
|
data();
|
|
return;
|
|
}
|
|
data.forEach(function (fn) { fn(); });
|
|
}).observe(node, { characterData: true });
|
|
return function (fn) {
|
|
callable(fn);
|
|
if (queue) {
|
|
if (typeof queue === 'function') queue = [queue, fn];
|
|
else queue.push(fn);
|
|
return;
|
|
}
|
|
queue = fn;
|
|
node.data = (i = ++i % 2);
|
|
};
|
|
};
|
|
|
|
module.exports = (function () {
|
|
// Node.js
|
|
if ((typeof process !== 'undefined') && process &&
|
|
(typeof process.nextTick === 'function')) {
|
|
return process.nextTick;
|
|
}
|
|
|
|
// MutationObserver=
|
|
if ((typeof document === 'object') && document) {
|
|
if (typeof MutationObserver === 'function') {
|
|
return byObserver(MutationObserver);
|
|
}
|
|
if (typeof WebKitMutationObserver === 'function') {
|
|
return byObserver(WebKitMutationObserver);
|
|
}
|
|
}
|
|
|
|
// W3C Draft
|
|
// http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html
|
|
if (typeof setImmediate === 'function') {
|
|
return function (cb) { setImmediate(callable(cb)); };
|
|
}
|
|
|
|
// Wide available standard
|
|
if (typeof setTimeout === 'function') {
|
|
return function (cb) { setTimeout(callable(cb), 0); };
|
|
}
|
|
|
|
return null;
|
|
}());
|
|
|