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.
40 lines
851 B
40 lines
851 B
4 years ago
|
'use strict';
|
||
|
|
||
|
var utils = require('./utils');
|
||
|
var resolve = require('./resolve');
|
||
|
|
||
|
function flowFactory(flow) {
|
||
|
return function(/* list of tasks/functions to compose */) {
|
||
|
var args = [].concat.apply([], [].slice.call(arguments));
|
||
|
var self = this;
|
||
|
return function(done) {
|
||
|
if (typeof done !== 'function') {
|
||
|
done = function(err) {
|
||
|
if (err) {
|
||
|
self.emit('error', err);
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
var fns;
|
||
|
try {
|
||
|
fns = resolve.call(self, args);
|
||
|
} catch (err) {
|
||
|
return done(err);
|
||
|
}
|
||
|
if (fns.length === 1) {
|
||
|
return fns[0](done);
|
||
|
}
|
||
|
|
||
|
var batch;
|
||
|
try {
|
||
|
batch = utils.bach[flow].apply(utils.bach, fns);
|
||
|
} catch (err) {
|
||
|
return done(err);
|
||
|
}
|
||
|
return batch(done);
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
|
||
|
module.exports = flowFactory;
|