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.
31 lines
1.3 KiB
31 lines
1.3 KiB
// The rational behind the verbose Reflect-feature check below is the fact that there are polyfills
|
|
// which add an implementation for Reflect.defineMetadata but not for Reflect.getOwnMetadataKeys.
|
|
// Without this check consumers will encounter hard to track down runtime errors.
|
|
export function reflectionIsSupported() {
|
|
return typeof Reflect !== 'undefined' && Reflect.defineMetadata && Reflect.getOwnMetadataKeys;
|
|
}
|
|
export function copyReflectionMetadata(to, from) {
|
|
forwardMetadata(to, from);
|
|
Object.getOwnPropertyNames(from.prototype).forEach(key => {
|
|
forwardMetadata(to.prototype, from.prototype, key);
|
|
});
|
|
Object.getOwnPropertyNames(from).forEach(key => {
|
|
forwardMetadata(to, from, key);
|
|
});
|
|
}
|
|
function forwardMetadata(to, from, propertyKey) {
|
|
const metaKeys = propertyKey
|
|
? Reflect.getOwnMetadataKeys(from, propertyKey)
|
|
: Reflect.getOwnMetadataKeys(from);
|
|
metaKeys.forEach(metaKey => {
|
|
const metadata = propertyKey
|
|
? Reflect.getOwnMetadata(metaKey, from, propertyKey)
|
|
: Reflect.getOwnMetadata(metaKey, from);
|
|
if (propertyKey) {
|
|
Reflect.defineMetadata(metaKey, metadata, to, propertyKey);
|
|
}
|
|
else {
|
|
Reflect.defineMetadata(metaKey, metadata, to);
|
|
}
|
|
});
|
|
}
|
|
|