Evaluation
Let’s check the test accuracy by below code.
Python3
test_error, test_accuracy = model.evaluate(X_test, y_test, verbose = 1 ) print (f "Test accuracy: {test_accuracy}" ) |
Output :
Test accuracy: 0.7566666603088379
Now we can evaluate the accuracy using line-plots.
Python3
fig, axs = plt.subplots( 2 ,figsize = ( 10 , 10 )) # accuracy axs[ 0 ].plot(hist.history[ "accuracy" ], label = "train" ) axs[ 0 ].plot(hist.history[ "val_accuracy" ], label = "test" ) axs[ 0 ].set_ylabel( "Accuracy" ) axs[ 0 ].legend() axs[ 0 ].set_title( "Accuracy" ) # Error axs[ 1 ].plot(hist.history[ "loss" ], label = "train" ) axs[ 1 ].plot(hist.history[ "val_loss" ], label = "test" ) axs[ 1 ].set_ylabel( "Error" ) axs[ 1 ].legend() axs[ 1 ].set_title( "Error" ) plt.show() |
Output :
Music Genre Classifier using Machine Learning
Music is the art of arranging sound and noise together to create harmony, melody, rhythm, and expressive content. It is organized so that humans and sometimes other living organisms can express their current emotions with it.
We all have our own playlist, which we listen to while traveling, studying, dancing, etc.
In short, every emotion has a different genre. So here today, we will study how can we implement the task of genre classification using Machine Learning in Python.
Before starting the code, download the data from this link.
Let’s start with the code.