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.
48 lines
864 B
48 lines
864 B
4 years ago
|
/*!
|
||
|
* tableize-object (https://github.com/jonschlinkert/tableize-object)
|
||
|
*
|
||
|
* Copyright (c) 2016, Jon Schlinkert.
|
||
|
* Licensed under the MIT License.
|
||
|
*/
|
||
|
|
||
|
'use strict';
|
||
|
|
||
|
var isObject = require('isobject');
|
||
|
|
||
|
/**
|
||
|
* Tableize `obj` by flattening its keys.
|
||
|
*
|
||
|
* @param {Object} `obj`
|
||
|
* @return {Object}
|
||
|
* @api public
|
||
|
*/
|
||
|
|
||
|
module.exports = function tableize(obj) {
|
||
|
var target = {};
|
||
|
flatten(target, obj, '');
|
||
|
return target;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Recursively flatten object keys to use dot-notation.
|
||
|
*
|
||
|
* @param {Object} `target`
|
||
|
* @param {Object} `obj`
|
||
|
* @param {String} `parent`
|
||
|
*/
|
||
|
|
||
|
function flatten(target, obj, parent) {
|
||
|
for (var key in obj) {
|
||
|
if (obj.hasOwnProperty(key)) {
|
||
|
var val = obj[key];
|
||
|
|
||
|
key = parent + key;
|
||
|
if (isObject(val)) {
|
||
|
flatten(target, val, key + '.');
|
||
|
} else {
|
||
|
target[key] = val;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|