..
Done
============================
Module 0 - Fundamentals
============================
.. image:: figs/Module/module.png
:align: center
This introductory module is focused on introducing several core
technologies used for testing and debugging in future
modules, and also includes some basic mathematical foundations.
In this module, you will start to build up some of the
infrastructure for MiniTorch.
All starter code is available in https://github.com/minitorch/Module-0 .
Before starting this assignment, make sure to set up your workspace following
:doc:`setup`, and
read :doc:`contributing` to understand how the code should be organized.
Each module has a set of `Guides` to help with the tasks. We recommend
working through the assignment and utilizing the Guides suggested for
each task.
.. toctree::
:maxdepth: 3
:glob:
:caption: Guides
property_testing
modules
visualization
Tasks
******
Task 0.1: Operators
========================
This task is designed to help you get comfortable with style checking
and testing. We ask you to implement a series of basic mathematical
functions. These functions are simple, but they form the basis
of MiniTorch. Make sure that you understand each of them as
some terminologies might be new.
.. todo::
Complete the following functions in `minitorch/operators.py` and pass
tests marked as `task0_1`.
.. autofunction:: minitorch.operators.mul
.. autofunction:: minitorch.operators.id
.. autofunction:: minitorch.operators.neg
.. autofunction:: minitorch.operators.add
.. autofunction:: minitorch.operators.lt
.. autofunction:: minitorch.operators.sigmoid
.. autofunction:: minitorch.operators.relu
.. autofunction:: minitorch.operators.relu_back
Task 0.2: Testing and Debugging
===============================
.. note::
This task requires familiarity with testing and property
tests. Make sure to first read the guide on
:doc:`property_testing`, and consult the `Hypothesis
`_ documentation.
We ask you to implement property tests for your operators from Task 0.1. These
tests should ensure that your functions not only work but also obey
high-level mathematical properties for any input.
Note that you need to change arguments for those test functions.
.. todo::
Complete the test functions in `tests/test_operators.py` marked as
`task0_2`.
Task 0.3: Functional Python
============================
.. note::
This task requires familiarity with basic functional programming concepts
and notation.
This subject is outside the scope
of guides provided here, but this `tutorial
`_
is a good starting place.
To practice the use of higher-order functions in Python, implement three basic
functional concepts. Use them in combination with operators described in
Task 0.1
to build up more complex mathematical operations that work on lists instead
of single values.
.. todo::
Complete the following functions in `minitorch/operators.py` and pass
tests marked as `tasks0_3`.
.. autofunction:: minitorch.operators.map
.. autofunction:: minitorch.operators.negList
.. autofunction:: minitorch.operators.zipWith
.. autofunction:: minitorch.operators.addLists
.. autofunction:: minitorch.operators.reduce
.. autofunction:: minitorch.operators.sum
.. autofunction:: minitorch.operators.prod
Task 0.4: Modules
=====================
.. note:: This task requires familiarity with neural network Modules.
Please read :doc:`modules` to get started.
If you want more context for how modules are used,
you may find it helpful to skip ahead and read the `torch module
tutorial
`_.
This task is to implement the core structure of the :class:`minitorch.Module`
class. We ask you to implement a tree data structure that
stores named :class:`minitorch.Parameter` on each node. Such a data structure
makes it
easy for users to create trees that can be `walked` to find all of the
parameters of
interest.
.. todo::
Complete the functions in `minitorch/module.py` and pass tests marked as
`tasks0_4`.
.. autofunction:: minitorch.Module.train
.. autofunction:: minitorch.Module.eval
.. autofunction:: minitorch.Module.named_parameters
Task 0.5: Visualization
========================
.. note::
This task requires familiarity with visualization tools described in
:doc:`visualization` as well
as the documentation for `Visdom
`_.
For the first few assignments, we use a set of datasets implemented in
`project/datasets.py`,
which are 2D point classification datasets. (See `TensorFlow Playground
`_
for similar examples.) Each of these dataset can be added to the visualization
using::
from project.datasets import Simple, Split, Xor
N = 100
Simple(N, vis=True).graph("initial")
You can also provide a model that attempts to perform the classfication::
def classify(pt):
"Classify based on x position"
if pt[0] > 0.5:
return 1.0
else:
return 0.0
Split(N, vis=True).graph("initial", model=classify)
.. todo::
Start a visdom server and print an image of the dataset. Hand-create
classifiers that
split each of the datasets into the correct colors. Display your images
on the README file in your
repo.
Optional
===========
Read through the code in `project/run_torch.py` to get a sneak peek of
an implementation of a model for these datasets using Torch.