Skip to content

Instantly share code, notes, and snippets.

@jwalsh
Last active January 8, 2019 17:06
Show Gist options
  • Select an option

  • Save jwalsh/825d6530c677535bfc6fef19b315e444 to your computer and use it in GitHub Desktop.

Select an option

Save jwalsh/825d6530c677535bfc6fef19b315e444 to your computer and use it in GitHub Desktop.
// Create mock features for evaluating AWS ML performance
const fs = require('fs');
let header = [];
['training', 'batch-prediction']
.map(s => {
'abcdefghijklmnopqrstuvwxyz'
.split('')
.map(l => {
'0123456789'
.split('')
.map(n => header.push(`${l}${n}`));
});
// console.log(header);
// Target
const TARGET = 't';
if (s === 'training') {
header.push(TARGET);
}
let mocks = (new Array(999))
.fill(null)
.map((me, mi) => {
let mock = header
// Training data includes target
.map(e => {
if (s !== 'training' && e === TARGET) {
parseFloat(Math.random().toFixed(2));
}
});
return mock.join(',');
});
const result = [header]
.concat(mocks)
.join('\n');
fs.writeFileSync(`mock-features-${s}.csv`, result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment