CS 5043: HW1
Assignment notes:
- Deadline: Friday, February 7th @11:59pm.
- Hand-in procedure: submit PDF to the HW1 dropbox on Gradescope,
and the Jupyter notebook to Canvas.
- This work is to be done on your own. While general discussion
about Python, TensorFlow and Keras is okay, sharing solution-specific code is inappropriate.
Likewise, you may not download code solutions to this problem from the network.
Data Set
The hw1_dataset.pkl file contains the
data set for this assignment. This file contains one python object, a
dictionary, that has two properties: ins and outs. The
following code snippet will load the data into your python environment:
fp = open("hw1_dataset.pkl", "rb")
foo = pickle.load(fp)
fp.close()
Notes:
- We have assumed that this file is in the same directory as
your notebook
- There is only a training set (no validation or test sets)
Part 1: Network
-
Write a function that constructs a neural network that can regenerate the
output from the corresponding inputs.
-
The first thing that you try will likely not work. You will need to
think about the appropriate non-linearities to use and to play with the number
of layers/neurons.
Part 2: Multiple Runs
- Write a function that performs 10 independent learning runs
- Plot the learning curves (MSE as a function of epoch) for all
10 runs on the same plot
- Compute the absolute prediction errors for all runs, combine
the data and generate a histogram of the absolute errors
Hints
-
Once a model is trained, you can ask it to predict output values for a
set of examples using the model.predict() function
-
Numpy provides an absolute value operator: np.abs()
-
Matplotlib provides an easy way to generate histograms:
plt.hist(errors, 50) This generates a histogram with 50 bins
Expectations
- Terminal MSE for the individual runs should be very low. If
this is not the case, then go back to your network design.
- It is very hard to learn a network that generates the correct
output for every example. Getting a couple examples wrong in individual runs is okay.
What to Hand-In
- Hand in both Jupyter notebook (to Canvas) and the corresponding
PDF (to Gradescope).
Within Jupyter, you can generate a PDF by selecting File/Export
As/PDF.
Note: the PDF generator is not particularly smart about not
cutting off code on the right-hand-side of the PDF page. Check
your PDF and if this is happening, then add newlines to make
your lines shorter.
- Do not submit MSWord files.
Grading
- 50 pts: low MSE for every run
- 20 pts: few prediction errors greater than 0.4
- 20 pts: well structured code
- 10 pts: appropriate documentation
- 10 pts (bonus): all prediction errors less than 0.4
andrewhfagg -- gmail.com
Last modified: Sun Feb 2 00:11:33 2020