Book Image

Python Artificial Intelligence Projects for Beginners

By : Dr. Joshua Eckroth
Book Image

Python Artificial Intelligence Projects for Beginners

By: Dr. Joshua Eckroth

Overview of this book

Artificial Intelligence (AI) is the newest technology that’s being employed among varied businesses, industries, and sectors. Python Artificial Intelligence Projects for Beginners demonstrates AI projects in Python, covering modern techniques that make up the world of Artificial Intelligence. This book begins with helping you to build your first prediction model using the popular Python library, scikit-learn. You will understand how to build a classifier using an effective machine learning technique, random forest, and decision trees. With exciting projects on predicting bird species, analyzing student performance data, song genre identification, and spam detection, you will learn the fundamentals and various algorithms and techniques that foster the development of these smart applications. In the concluding chapters, you will also understand deep learning and neural network mechanisms through these projects with the help of the Keras library. By the end of this book, you will be confident in building your own AI projects with Python and be ready to take on more advanced projects as you progress
Table of Contents (11 chapters)

Identifying the genre of a song with neural networks


In this section, we're going to build a neural network that can identify the genre of a song. We will use the GTZAN Genre Collection (http://marsyasweb.appspot.com/download/data_sets/.GTZAN Genre Collection). It has 1,000 different songs from over 10 different genres. There are 100 songs per genre and each song is about 30 seconds long.

We will use the  Python library, librosa to extract features from the songs. We will use Mel-frequency cepstral coefficients (MFCC). MFCC values mimic human hearing and they are commonly used in speech recognition applications as well as music genre detection. These MFCC values will be fed directly into the neural network.

To help us understand the MFCC, let's use two examples. Download Kick Loop 5 by Stereo Surgeon. You can do this by visiting https://freesound.org/people/Stereo%20Surgeon/sounds/266093/, and download Whistling by cmagar by visiting https://freesound.org/people/grrlrighter/sounds/98195/....