How to tune hyperparameters for better neural network performance

How to tune hyperparameters for better neural network performance

With an example

Photo by Markus Spiske on Unsplash

How to choose a number of hidden layers

Summary of the number of hidden layers

How to choose a number of neurons

Summary of the number of neurons in a hidden layer

How to choose batch size, learning rate, epoch

Summary of learning rate, epoch, batch size

Tuning hyperparameters example

Code for the basic structure / Basic structure of the mlp

Code for grid search CV and early stopping

Code for f1_loss written by Michal HaltufBest hyperparameters

Training history of a learning rate of 0.1 with a batch size of 60

Test result of the best mlp network

Reflection

Trial 1Trial 2

Code for 30 repetitions / average statistics of the 30 repetitions