Last active
January 8, 2019 17:06
-
-
Save jwalsh/825d6530c677535bfc6fef19b315e444 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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