My notes on machine learning
Instead of calculating derivatives myself, we use the torch.autograd to compute gradients.
Implemented k-nearest neighbors algorithm by C++.
Implemented backpropagation algorithm. Trained a 2-layer neural networks.
Its model file is trained.npz.
MultiHiddenLayerNN.ipynb
Implemented a multilayer neural networks, of which activation functions are all sigmoid.
Using PyTorch only for matrix multiplication.
Verified that sigmoid activation function can cause vanishing gradient.
MultiHiddenLayerNNReLU.ipynb
Replaced sigmoid funtions in MultiHiddenLayerNN.ipynb with ReLU except the last layer. Vanishing gradient solved.
Its model file is model_ReLU94.pth,whose test accuracy is 94%.
Updated from BPNetworks.ipynb.
Using PyTorch to do matrix multiplication to speed up.
Its model file is trained_model_tensor.pt and trained_model_tensor2.pt
Its model file is model_final.pdparams.