{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Homework 2 is due on 6/18. Please upload your completed assignment to Canvas as a .py script which consists of all the necessary functions.\n", "\n", "Name your script hw2_loginID.py For instance, I would name my script hw2_rlthomas3.py, since rlthomas3 is my USF login ID (it's what comes before @usfca.edu in my email address)." ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "1\\. Consider this $5x5$ matrix :\n", "\n", "\\begin{pmatrix}\n", " 1 & & & -2 & \\\\\n", " & 3 & & & -9 \\\\\n", " & & -7 & 4 & \\\\ \n", " -1 & 2 & 7 & & \\\\\n", " -3 & & 26 & &\n", " \\end{pmatrix}\n", " \n", " a. Write how it would be stored in coordinate-wise format. Your answer should be a dictionary named `coo` with keys: `vals`, `cols`, and `rows`\n", " \n", " b. Write how it would be stored in compressed row format. Your answer should be a dictionary named `csr` with keys: `vals`, `cols`, and `row_ptr`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "2\\. Write a method that uses regex:\n", "\n", "`get_dimensions(\"1280x720\")` should return `1280, 720`" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def get_dimensions(text):\n", " # something with regex\n", " return int(dim1), int(dim2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "3\\. Use regex to pick out the names of PDFs.\n", "\n", "`get_pdf_names(\"file_record_transcript.pdf\")` should return `\"file_record_transcript\"`\n", "\n", "`get_pdf_names(\"testfile_fake.pdf.tmp\")` should return `None`" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "def get_pdf_names(text):\n", " # something with regex\n", " \n", " return pdf_name" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "4\\. For each of the following, answer whether they are **parameters** or **activations**:\n", "\n", "- weights in a pre-trained network\n", "- hidden state in an RNN\n", "- attention weights\n", "\n", "Submit answer via this jot form: https://form.jotform.com/91605828322154" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }