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.
36 lines
934 B
36 lines
934 B
4 years ago
|
var fs = require("fs");
|
||
|
|
||
|
function handleEpipe(error) {
|
||
|
if (error.code === "EPIPE" || error.errno === "EPIPE") {
|
||
|
process.exit(0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = function(file) {
|
||
|
var output = (file === "-" ? process.stdout : fs.createWriteStream(file)).on("error", handleEpipe),
|
||
|
queue = Promise.resolve();
|
||
|
return {
|
||
|
write: function(data) {
|
||
|
return queue = queue.then(function() {
|
||
|
return new Promise(function(resolve, reject) {
|
||
|
output.write(data, function(error) {
|
||
|
if (error) reject(error);
|
||
|
else resolve();
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
end: function() {
|
||
|
if (output === process.stdout) return queue;
|
||
|
return queue = queue.then(function() {
|
||
|
return new Promise(function(resolve, reject) {
|
||
|
output.end(function(error) {
|
||
|
if (error) reject(error);
|
||
|
else resolve();
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
};
|