A simple implementation of model-agnostic meta-learning

For this tutorial, we will be showcasing how we can apply MAML to learn a simple curve of sinusoidal data. The second part of this tutorial is available on GitHub, where we can learn about how to train MAML on mini-ImageNet using the torch-meta library.

Let's begin this tutorial by going through the following steps:

  1. Import all libraries:
import mathimport randomimport torchfrom torch import nnfrom torch.nn import functional as Fimport matplotlib as mplmpl.use('Agg')import matplotlib.pyplot as plt%matplotlib inline
  1. Create a simple neural network architecture. We will be getting randomly generated data of the sinusoidal curve. We will be using this very small network, as we don't ...

Get Hands-On One-shot Learning with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.