Multi-class classification

Introduction to Deep Learning with Keras

Miguel Esteban

Data Scientist & Founder

Throwing darts

Introduction to Deep Learning with Keras

The dataset

Introduction to Deep Learning with Keras

The dataset

Introduction to Deep Learning with Keras

The architecture

Introduction to Deep Learning with Keras

The architecture

Introduction to Deep Learning with Keras

The architecture

Introduction to Deep Learning with Keras

The output layer

Introduction to Deep Learning with Keras

Multi-class model

# Instantiate a sequential model
# ...

# Add an input and hidden layer # ...
# Add more hidden layers # ...
# Add your output layer model.add(Dense(4, activation='softmax')
Introduction to Deep Learning with Keras

Categorical cross-entropy

model.compile(optimizer='adam', loss='categorical_crossentropy')

Introduction to Deep Learning with Keras

Preparing a dataset

import pandas as pd
from tensorflow.keras.utils import to_categorical

# Load dataset
df = pd.read_csv('data.csv')

# Turn response variable into labeled codes df.response = pd.Categorical(df.response) df.response = df.response.cat.codes
# Turn response variable into one-hot response vector y = to_categorical(df.response)
Introduction to Deep Learning with Keras

One-hot encoding

Introduction to Deep Learning with Keras

Let's practice!

Introduction to Deep Learning with Keras

Preparing Video For Download...