Lesson 2

Notes from fastai lesson 2.

Notes

Transfer learning: using an existing architecture to create a model trained on a particular data set

Error is one kind of metric, measuring “how well you’re doing” Loss is a measure of performance used to improve the parameters. “Are we learning (adjusting our parameters)?”

Model training

  • Built a model from Bing API search results (grizzly vs black vs teddy bears)
  • Used DataBlock() to create a dataset
  • Used dataloaders to load the data into memory
  • Used the resnet18 architecture to train a model using the dataset, similar to lesson 1
  • Exported the model via pickle to productionize it - model contains the architecture + new parameters + vocabulary (labels)
  • Used the model to perform inference on images the model has not seen before
  • Used ImageClassifierCleaner() to clean the dataset

Next lesson

  • Deploying to binder, treating your model as if it’s in production by uploading new images to it in “production”

Jargon

Jargon We Use (again) Description
Label The data we’re trying to predict (recall the diagram)
Architecture A template of the model we are trying to fit. It represents the mathematical function we pass inputs & parameters to.
Model An architecture with a specific set of parameters. The parameters may be created through training over one or more epochs.
Parameters The values of the model that we can alter trough training.
Fit or Train Updating the parameters such that the model is better able to predict our labels.
Pretrained model A model with parameters adjusted via training, typically will be fine_tune()d, such as resnet34.
fine tune Update a pretrained model for another task, such as making resnet34 recognize cats or dogs.
epoch One complete pass through the input data
metric A measure of how good the model is to control training via SGD
validation set A subset of our data we do not train our model with to measure its performance
training set A subset of our data we train our model with that does not include any data from the validation set
overfitting Training a model that results in memorization rather than generalization
cnn A convolutional neural network, a type of NN suited for computer vision

Flash Cards:

  • Architecture vs. Model?
    • A model includes an architecture with a specific set of parameters. These parameters allow the architecture to do something it wasn’t originally designed to do.

Where is Deep Learning good?

  1. Computer Vision - detection & classification
  2. Text - Classifiction & conversation (but not really)
  3. Tabular - Effective on high cardinality datasets, e.g. part numbers and serial numbers
  4. Recommendation Systems (Recsys, aka Collaborative Filtering), but note predictions <> recommendations - because you like to read science fiction, a model might predict you’ll like Aasimov - but that might not be what you want from a recommendation engine e.g. if you’re branching out to Romance.
  5. Multi-modal - Combining the above, capition images, humans in the loop
  6. Various other - NLP, protein

Products in the wild

  1. Arsenal 2, combining a camera with an AI platform
  2. Birdsy, using computer vision to classify birds in real time

Get Writing

This blog :)

Questionaire

Questions 1-12 are annswered in my lesson 1 notes.

  1. What is a p value?

    A p-value is the probability of an observed result assuming that the null hypothesis is true. They are terrible and shouldn’t be relied on, per the American Statistical Association. It does not provide a good measure of evidence for scientific conclusions to be made.

    See p-value

  2. What is a prior?

    Not clear what this question is asking and it’s not listed in the book.

  3. Provide an example of where the bear classification model might work poorly in production, due to structural or style differences in the training data.

    The model is not well trained on pictures of bears from various angels. The model might struggle with images of bears from above, or from behind, or partial images.

  4. Where do text models currently have a major deficiency?
    • This is question 1 of Ch 2. in the book.
  5. What are possible negative societal implications of text generation models? In situations where a model might make mistakes, and those mistakes could be harmful, what is a good alternative to automating a process?

  6. What kind of tabular data is deep learning particularly good at?

  7. What’s a key downside of directly using a deep learning model for recommendation systems?

    It doesn’t know how to recommend things outside of its domain that you might still be interested in.

  8. What are the steps of the Drivetrain Approach?

  9. How do the steps of the Drivetrain Approach map to a recommendation system?

  10. Create an image recognition model using data you curate, and deploy it on the web.

  11. What is DataLoaders?

    A class that helps prepare a dataset.

  12. What four things do we need to tell fastai to create DataLoaders?

    1. How to find the data (get_items)
    2. How to get the dependent and independent variable(s) (get_x, get_y)
    3. Create the data blocks (e.g. images and labels)
    4. How to transform the items, such as Resize(128).
  13. What does the splitter parameter to DataBlock do?

    It defines how your data is split up into a training set and a validation set.

  14. How do we ensure a random split always gives the same validation set?

    Use a seed value by speifying seed=int when calling RandomSplitter().