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.
56 lines
1.0 KiB
56 lines
1.0 KiB
4 years ago
|
'use strict';
|
||
|
|
||
|
var extend = require('extend-shallow');
|
||
|
var yaml = require('js-yaml');
|
||
|
|
||
|
/**
|
||
|
* Default engines
|
||
|
*/
|
||
|
|
||
|
var engines = exports = module.exports;
|
||
|
|
||
|
/**
|
||
|
* YAML
|
||
|
*/
|
||
|
|
||
|
engines.yaml = {
|
||
|
parse: yaml.safeLoad.bind(yaml),
|
||
|
stringify: yaml.safeDump.bind(yaml)
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* JSON
|
||
|
*/
|
||
|
|
||
|
engines.json = {
|
||
|
parse: JSON.parse.bind(JSON),
|
||
|
stringify: function(obj, options) {
|
||
|
var opts = extend({replacer: null, space: 2}, options);
|
||
|
return JSON.stringify(obj, opts.replacer, opts.space);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* JavaScript
|
||
|
*/
|
||
|
|
||
|
engines.javascript = {
|
||
|
parse: function parse(str, options, wrap) {
|
||
|
/* eslint no-eval: 0 */
|
||
|
try {
|
||
|
if (wrap !== false) {
|
||
|
str = '(function() {\nreturn ' + str.trim() + ';\n}());';
|
||
|
}
|
||
|
return eval(str) || {};
|
||
|
} catch (err) {
|
||
|
if (wrap !== false && /(unexpected|identifier)/i.test(err.message)) {
|
||
|
return parse(str, options, false);
|
||
|
}
|
||
|
throw new SyntaxError(err);
|
||
|
}
|
||
|
},
|
||
|
stringify: function() {
|
||
|
throw new Error('stringifying JavaScript is not supported');
|
||
|
}
|
||
|
};
|