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.
47 lines
871 B
47 lines
871 B
'use strict';
|
|
|
|
var debug = require('../debug');
|
|
var utils = require('../utils');
|
|
|
|
/**
|
|
* Define data to be used for rendering templates.
|
|
*
|
|
* ```sh
|
|
* $ app --data=foo:bar
|
|
* # {foo: 'bar'}
|
|
*
|
|
* $ app --data=foo.bar:baz
|
|
* # {foo: {bar: 'baz'}}
|
|
*
|
|
* $ app --data=foo:bar,baz
|
|
* # {foo: ['bar', 'baz']}}
|
|
* ```
|
|
* @name data
|
|
* @api public
|
|
*/
|
|
|
|
module.exports = function(app, base) {
|
|
return function(val, key, config, next) {
|
|
debug.field(key, val);
|
|
|
|
if (utils.show(val)) {
|
|
console.log(utils.formatValue(app.cache.data));
|
|
next();
|
|
return;
|
|
}
|
|
|
|
if (typeof app.data === 'function') {
|
|
app.data(val);
|
|
|
|
} else {
|
|
for (var prop in val) {
|
|
app.emit('data', prop, val[prop]);
|
|
}
|
|
app.cache.data = utils.merge({}, app.cache.data, val);
|
|
val = app.cache.data;
|
|
}
|
|
|
|
config[key] = val;
|
|
next();
|
|
};
|
|
};
|
|
|