Using fastai to set up model training in a few minutes
In this section, we will use the fastai library [1] to train and evaluate a handwritten digit classification model in fewer than 10 lines of code. We will also use fastai’s interpretability module to understand where the trained model fails to perform well. The full code for the exercise can be found in our GitHub repository [2].
Setting up fastai and loading data
In this section, we will first import the fastai library, then load the MNIST
dataset, and finally, preprocess the dataset for model training. We’ll proceed as follows:
- First, we will import fastai in the recommended way, as shown here:
import os from fast.ai.vision.all import *
Although import *
is not the recommended way of importing libraries in Python, the fastai documentation suggests this format [3].
Basically, this line of code imports some of the key modules from the fastai library that are usually...