Introduction

In this tutorial, we want to create an Artificial Neural Network (ANN) that is able to recognize the species of penguins based on their body measurements. We will cover the entire process from Data Collection, Data Cleansing and Feature Engineering to Model Creation and Model Training.

Use Case

Based on body measurements of a penguin such as Bill length, Flipper Length and Body Mass, we want to predict the species of the penguin.

A penguin can be one of the following three species:

  • Adelie
  • Chinstrap
  • Gentoo
💡
This is a Multi-Class Classification Problem!

Visualized, the Use Case looks as follows:

AI Model

Let's take a closer look at the AI model we use. For this use case, we want to use an Artificial Neural Network (ANN). The Neural Network should be able to solve this Multi-Classification Problem. In order to do this, we use the following Network Architecture.

Due to 6 features, the input layer consists of 6 neurons. Due to the 3 classes, we have 3 neurons in the output layer.

Now let's go through the Python code step by step.

Import Modules

First, let's import the following Python moduls:

import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import pandas as pd
from pandas.api.types import is_object_dtype
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import StandardScaler
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers, models
from tensorflow.keras.layers import Dense
from tensorflow.keras.optimizers import Adam, Adagrad, SGD, RMSprop
from keras.models import Sequential
from keras.utils import to_categorical

You can view this post with the tier: Academy Membership

Join academy now to read the post and get access to the full library of premium posts for academy members only.

Join Academy Already have an account? Sign In