O'Reilly logo
live online training icon Live Online training

Intermediate Machine Learning with PyTorch

Hands-on analyses of text corpora and images

David Mertz, Ph.D.

PyTorch is one of the premier libraries for programming deep neural networks in Python. There is a great deal of subtlety in the design and implementation of effective neural networks. The course walks the student through creating networks for two popular domain areas: text analysis and image classification. We focus both on the general designs of layers and the specific APIs of PyTorch.

What you'll learn-and how you can apply it

  • Gain an understanding of general NLP (Natural Language Processing) goals.
  • Understand how to apply deep learning techniques to NLP.
  • Utilize and customize pre-trained neural network models.
  • Customize network layers and examine effects of changes.

This training course is for you because...

You are an aspiring or beginning data scientist.
- You have a comfortable intermediate-level knowledge of Python and a very basic familiarity with statistics and linear algebra. - You are a working programmer or student who is motivated to expand your skills to include machine learning with Python. - You have heard about the enormous promise and power of deep neural networks.


  • A first course in Python and/or working experience as a programmer
  • College-level basic mathematics

Course Set-up

Students should have a system with Jupyter notebooks installed, a recent version of scikit-learn, along with Pandas, NumPy, and matplotlib, and the general scientific Python tool stack. The training materials will be made available as notebooks at a GitHub repository.

Recommended Preparation

These resources are optional, but helpful if you need a refresher on Python, Jupyter Notebooks, or Pandas: - (video) Python Programming Language LiveLessons by David Beazley - (video) Modern Python LiveLessons: Big Ideas and Little Code in Python by Ramond Hettinger - (video) Using Jupyter Notebooks for Data Science Analysis in Python LiveLessons by Jamie Whitacre - (video) Pandas Data Analysis with Python Fundamentals by Daniel Y. Chen

Recommended Follow-up

About your instructor

  • David Mertz is Chief Technology Officer for Bold Metrics Inc. Prior to that, he created and structured the training program for Anaconda, Inc. He was a Director of the Python Software Foundation for six years and remains co-chair of its Trademarks Committee and of the PSF Scientific Python Working Group. David worked for nine years with D. E. Shaw Research. This research group built the world's fastest—highly-specialized—supercomputer for performing molecular dynamics.

    David wrote the widely read columns Charming Python and XML Matters for IBM developerWorks, short books for O'Reilly, and the Addison-Wesley book Text Processing in Python. He has spoken at multiple OSCons, PyCons, and AnacondaCon, and was invited to be a keynote speaker at PyCon-India, PyCon-UK, PyCon-ZA [South Africa], PyCon Belarus, PyCon Cuba, and PyData SF. He delivers several recurring webinars, and video courses, for Safari Online.

    David is delighted to find Python has the default high-level language for most scientific computing projects.


The timeframes are only estimates and may vary according to how the class is progressing

Lesson 1: Whirlwind overview of Machine Learning and PyTorch (1 hour)

  • Understand how deep neural networks are different from other ML
  • Understand classification versus regression versus clustering
  • Perform dimensionality reduction
  • Explain feature engineering
  • Types of network layers
  • Tensors and NumPy interfaces
  • Examining Autograd
  • Create a neural network with torch.nn

Lesson 2: Natural Language Processing with AllenNLP (1.5 hours)

  • What is AllenNLP?
  • What is SpaCy?
  • High Level Interfaces to NLP using PyTorch
  • Textual Entailment
  • Named Entity Recognition
  • Semantic Role Labeling
  • Machine Comprehension

Lesson 3: Enhancing an Image Classifier (1.5 hour)

  • Starting with torchvision.models
  • Retraining pretrained models
  • Modifying Network Layers
  • Understanding Effects of Network Structure