Instructions

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 4

DownloadInstructions
Open PDF In BrowserView PDF
Homework 1 Instructions
Sagie Benaim and Tomer Galanti
March 13, 2019
The homework assignment is to be done in groups of up to 3 students.
Submission deadline is 4th of April 2019. For the current assignment there is
no need for GPU usage and so we’ll not use the google cloud VM. Download
the zip file provided (assignment.zip) and unzip it 1 .

1

Setup

Follow the following setup instructions:

1.1

Jupyter

As for the Numpy tutorial, we’ll use Jupyter. Jupyter is a widely-used tool in
the machine-learning ecosystem which allows us to create interactive notebooks
containing live code, equations and text. If you didn’t already do so, download
it here: https://jupyter.org/install.

1.2

Conda

Next, install Conda, a popular package manager for Python: Download from
https://conda.io/miniconda.html (for Python 3) and follow instruction on:
https://conda.io/docs/user-guide/install/index.html.
The homework assignments come with an environment.yml file which defines
what third-party libraries we depend on. Conda will use this file to create a
virtual environment for you. This virtual environment includes python and all
other packages and tools we specified, separated from any preexisting python
installation you may have.
After installing conda, create your environment called hw1 env, by typing
from the hw1 folder:
conda env c r e a t e −f environment . yml
This will install all necessary third party packages in the environment hw1 env.
Next, activate the environment by typing:
1 This homework assignment is an adaptation of the one from the cs236605 course: https:
//vistalab-technion.github.io/cs236605/

1

conda a c t i v a t e hw1 env
Activating an environment simply means that the path to it’s python binaries (and packages) is placed at the beginning of your $PATH shell variable.
Therefore, running programs installed into the conda env (e.g. python) will
run the version from the env since it appears in the $PATH before any other
installed version.
After you finish the homework, deactivate the environment by typing:
conda d e a c t i v a t e
You can read more about conda here: https://conda.io/projects/conda/
en/latest/user-guide/tasks/manage-environments.html

1.3

Pycharm

For writing the actual code, it is recommended to use PyCharm, though you
can use any other IDE or software you wish. Using your university email, you
can download a professional version for free here: https://www.jetbrains.
com/student/.

2

Assignment

2.1

Folder Structure

After unzipping assignment.zip, you’ll have an assignment folder which consists
of the following:
1. hw1 folder: Python package containing the assignment code. All your
solutions will be implemented here.
2. tests folder: A package containing tests that run all the assignment notebooks and fail if there are errors.
3. PartN XYZ.ipynb where N is a number and XYZ is some name: A set
of jupyter notebooks that contain the instructions that will guide you
through the assignment. You won’t need to edit these except if you wish
to play around and to write your name at the beginning.
4. main.py: A script providing some utilities via a CLI. Mainly, you’ll run it
to create your submission after completing the assignment.
5. environment.yml: A file for conda, as described above.

2.2

Working with the Assingment

After activating conda (see above), the from the assignment folder, type:
jupyter lab

2

Follow the notebooks instructions statring from notebook 0. You are only
required to change the code in the folder hw1.
1. The notebooks contain material you need to know, instructions about
what to do and also code blocks that will test and visualize your implementations.
2. Within the notebooks, anything you need to do is marked with a TODO
beside it. It will explain what to implement and in which file.
3. Within the assignment code package, all locations where you need to write
code are marked with a special marker (YOUR CODE). Additionally,
implementation guidelines, technical details and hints are in some cases
provided in a comment above.
4. Sometimes there are open questions to answer. Your answers should also
be written within the assignment package, not within the notebook itself.
The notebook will specify where to write each answer.
Notes:
1. You should think of the code blocks in the notebooks as tests. They test
your solutions and they will fail if something is wrong. As such, if you
implement everything and the notebook runs without error, you can be
confident about your solution.
2. Please don’t put other files in the assignment directory. If you do, they
will be added to your submission which is automatically generated from
the contents of the assignment folder.
3. Always make sure the active conda env is hw1 env. If you get strange
errors or broken import statements, this is probably the reason. Note
that if you close your terminal session you will need to re-activate since
conda will use it’s default base environment.

2.3

Submitting your work

To generate your submission, run:
python main . py p r e p a r e −s u b m i s s i o n −−i d ID1 −−i d ID2 −−i d ID3
where ID1, ID2 and ID3 are your id numbers.
If there are errors when running your notebooks, it means there’s a problem
with your solution or that you forgot to implement something. Additionally,
you can use the –skip-run flag to skip running your notebooks (and just merge
them) in case you already ran everything and you’re sure that all outputs are
present:
python main . py p r e p a r e −s u b m i s s i o n −−s k i p −run −−i d . . .

3

If you are unable to solve the entire assignment and wish to submit a partial
solution you can create a submission with errors by adding an allow-errors flag,
like so:
python main . py p r e p a r e −s u b m i s s i o n −−a l l o w −e r r o r s −−i d . . .
Finally zip the output and submit it on Moodle.

4



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : Yes
Author                          : 
Create Date                     : 2019:03:13 16:42:06Z
Creator                         : LaTeX with hyperref package
Modify Date                     : 2019:03:13 16:42:06Z
PTEX Fullbanner                 : This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) kpathsea version 6.2.3
Producer                        : pdfTeX-1.40.18
Subject                         : 
Title                           : 
Trapped                         : False
Page Mode                       : UseOutlines
Page Count                      : 4
EXIF Metadata provided by EXIF.tools

Navigation menu