| 28 | let tf; |
| 29 | |
| 30 | function parseArgs() { |
| 31 | const parser = new argparse.ArgumentParser({ |
| 32 | description: 'TensorFlow.js Quantization Example: Training an MLP for the ' + |
| 33 | 'California Housing Price dataset.', |
| 34 | addHelp: true |
| 35 | }); |
| 36 | parser.addArgument('--epochs', { |
| 37 | type: 'int', |
| 38 | defaultValue: 200, |
| 39 | help: 'Number of epochs to train the model for.' |
| 40 | }); |
| 41 | parser.addArgument('--batchSize', { |
| 42 | type: 'int', |
| 43 | defaultValue: 128, |
| 44 | help: 'Batch size to be used during model training.' |
| 45 | }); |
| 46 | parser.addArgument('--validationSplit', { |
| 47 | type: 'float', |
| 48 | defaultValue: 0.2, |
| 49 | help: 'Validation split used for training.' |
| 50 | }); |
| 51 | parser.addArgument('--evaluationSplit', { |
| 52 | type: 'float', |
| 53 | defaultValue: 0.1, |
| 54 | help: 'Validation split used for testing after training (evaluation).' |
| 55 | }); |
| 56 | parser.addArgument('--modelSavePath', { |
| 57 | type: 'string', |
| 58 | defaultValue: './models/housing/original', |
| 59 | help: 'Path to which the model will be saved after training.' |
| 60 | }); |
| 61 | parser.addArgument('--gpu', { |
| 62 | action: 'storeTrue', |
| 63 | help: 'Use tfjs-node-gpu for training (requires CUDA-enabled ' + |
| 64 | 'GPU and supporting drivers and libraries.' |
| 65 | }); |
| 66 | return parser.parseArgs(); |
| 67 | } |
| 68 | |
| 69 | async function main() { |
| 70 | const args = parseArgs(); |