Description
1 Assignments Tips
The homeworks will start with the instructions below. The rest of this section is meant to help you choose a solution to typeset your work. For the programming part of the assignments, you should start getting confortable with the Python packages NumPy and matplotlib if you are not already.
1.1 LATEX
You should check the source file “hw0 latex.tex” in the .zip for an example of LATEXtypesetting.
Minted Package The minted package is convenient for including source code in your LaTeX document.
Including Python Code from File Here we’re extracting lines 4 through 13 from the file code.py.
def dotProduct(d1, d2):
“””
@param dict d1: a feature vector represented by a mapping from a
,→ feature (string) to a weight (float).
@param dict d2: same as d1
@return float: the dot product between d1 and d2
“”” if len(d1) < len(d2):
return dotProduct(d2, d1)
else: return sum(d1.get(f, 0) * v for f, v in d2.items())
1
Python Code Inline Here we’re extracting lines 4 through 13 from the file code.py.
def dotProduct(d1, d2):
“””
@param dict d1: a feature vector represented by a mapping from a
,→ feature (string) to a weight (float).
@param dict d2: same as d1
@return float: the dot product between d1 and d2
“”” if len(d1) < len(d2):
return dotProduct(d2, d1)
else: return sum(d1.get(f, 0) * v for f, v in d2.items())
1.2 Jupyter notebooks
Check “hw0 jupyter.ipynb” for a solution relying on Jupyter Notebooks.
2 Self-Assessment
In the .zip file, you will also find a ”math-self-assement.pdf”. The questionnaire is meant to give you a preview of the mathematical objects and notations we will use in the class. Take the time to have a quick look to be aware of were you stand!
2
Reviews
There are no reviews yet.