NOTE: This project is inspired by the Keras framework and is just for study purposes.
To quickly test the project, you can copy the code from the neural-network-standalone.js file and paste it into the console tab of your browser.
- Download mnist dataset on kaggle https://www.kaggle.com/datasets/hojjatk/mnist-dataset
- Extract and copy these files to mnist-data folder(create new one if needed):
- t10k-images.idx3-ubyte
- t10k-labels.idx1-ubyte
- train-images.idx3-ubyte
- train-labels.idx1-ubyte
- Install dependencies first:
npm install
- Run project
npm start
- node v16.14.0
- npm 8.3.1
Here is an example of how to create and summarize a model and save it after training:
let model = new Model('categorical_crossentropy', earlyStoppingCallback, epochEndCallback, ['loss', 'progress']);
model.add(new Dense(784, 10, 'leaky_relu'));
model.add(new Dense(10, 10, 'softmax'));
model.summary();
model.train(xTrain, yTrain, 10, 0.001);
model.save('./mnist_model.any_extension');