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.
139 lines
5.3 KiB
139 lines
5.3 KiB
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
|
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
|
|
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
|
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
|
function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
|
|
function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
|
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
|
|
// Date utility functions
|
|
import identity from './identity';
|
|
import { concat } from './array';
|
|
import { isDate, isString } from './inspect';
|
|
import { toInteger } from './number'; // --- Constants ---
|
|
|
|
var RX_DATE = /^\d+-\d+-\d+$/; // --- Date utility methods ---
|
|
// Create or clone a date (`new Date(...)` shortcut)
|
|
|
|
export var createDate = function createDate() {
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
|
|
return _construct(Date, args);
|
|
}; // Parse a date sting, or Date object, into a Date object (with no time information)
|
|
|
|
export var parseYMD = function parseYMD(date) {
|
|
if (isString(date) && RX_DATE.test(date.trim())) {
|
|
var _date$split$map = date.split('-').map(toInteger),
|
|
_date$split$map2 = _slicedToArray(_date$split$map, 3),
|
|
year = _date$split$map2[0],
|
|
month = _date$split$map2[1],
|
|
day = _date$split$map2[2];
|
|
|
|
return createDate(year, month - 1, day);
|
|
} else if (isDate(date)) {
|
|
return createDate(date.getFullYear(), date.getMonth(), date.getDate());
|
|
}
|
|
|
|
return null;
|
|
}; // Format a date object as `YYYY-MM-DD` format
|
|
|
|
export var formatYMD = function formatYMD(date) {
|
|
date = parseYMD(date);
|
|
|
|
if (!date) {
|
|
return null;
|
|
}
|
|
|
|
var year = date.getFullYear();
|
|
var month = "0".concat(date.getMonth() + 1).slice(-2);
|
|
var day = "0".concat(date.getDate()).slice(-2);
|
|
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
}; // Given a locale (or locales), resolve the browser available locale
|
|
|
|
export var resolveLocale = function resolveLocale(locales)
|
|
/* istanbul ignore next */
|
|
{
|
|
var calendar = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'gregory';
|
|
locales = concat(locales).filter(identity);
|
|
var fmt = new Intl.DateTimeFormat(locales, {
|
|
calendar: calendar
|
|
});
|
|
return fmt.resolvedOptions().locale;
|
|
}; // Create a `Intl.DateTimeFormat` formatter function
|
|
|
|
export var createDateFormatter = function createDateFormatter(locale, options)
|
|
/* istanbul ignore next */
|
|
{
|
|
var dtf = new Intl.DateTimeFormat(locale, options);
|
|
return dtf.format;
|
|
}; // Determine if two dates are the same date (ignoring time portion)
|
|
|
|
export var datesEqual = function datesEqual(date1, date2) {
|
|
// Returns true of the date portion of two date objects are equal
|
|
// We don't compare the time portion
|
|
return formatYMD(date1) === formatYMD(date2);
|
|
}; // --- Date "math" utility methods (for BCalendar component mainly) ---
|
|
|
|
export var firstDateOfMonth = function firstDateOfMonth(date) {
|
|
date = createDate(date);
|
|
date.setDate(1);
|
|
return date;
|
|
};
|
|
export var lastDateOfMonth = function lastDateOfMonth(date) {
|
|
date = createDate(date);
|
|
date.setMonth(date.getMonth() + 1);
|
|
date.setDate(0);
|
|
return date;
|
|
};
|
|
export var oneMonthAgo = function oneMonthAgo(date) {
|
|
date = createDate(date);
|
|
var month = date.getMonth();
|
|
date.setMonth(month - 1);
|
|
|
|
if (date.getMonth() === month) {
|
|
date.setDate(0);
|
|
}
|
|
|
|
return date;
|
|
};
|
|
export var oneMonthAhead = function oneMonthAhead(date) {
|
|
date = createDate(date);
|
|
var month = date.getMonth();
|
|
date.setMonth(month + 1);
|
|
|
|
if (date.getMonth() === (month + 2) % 12) {
|
|
date.setDate(0);
|
|
}
|
|
|
|
return date;
|
|
};
|
|
export var oneYearAgo = function oneYearAgo(date) {
|
|
date = createDate(date);
|
|
var month = date.getMonth();
|
|
date.setMonth(month - 12);
|
|
|
|
if (date.getMonth() !== month) {
|
|
date.setDate(0);
|
|
}
|
|
|
|
return date;
|
|
};
|
|
export var oneYearAhead = function oneYearAhead(date) {
|
|
date = createDate(date);
|
|
var month = date.getMonth();
|
|
date.setMonth(month + 12);
|
|
|
|
if (date.getMonth() !== month) {
|
|
date.setDate(0);
|
|
}
|
|
|
|
return date;
|
|
}; |