Sale!

# Homework 2: Python Programming

\$30.00

Category:
Rate this product

ECE4880J: Computer Vision
Homework 2: Python Programming

Instruction
• This homework is due at 11:59:59 p.m. on ** May 30th, 2022.
• The write-up must be an electronic version edited by LATEX using this template and submitted in pdf format.
• Please DO NOT rename python files and their functions. Just fill it.
• The overall submission should be a .zip file named by xxx(student id)-xxx(name)-Assignment2.zip
Python Environment. We are using Python 3.7 for this course. We will use the following packages
in this course: Numpy, SciPy, Matplotlib, Pytorch.
Q1. Welcome to Python [20 points]
Use Python to achieve the following functionality. Given an array of integers array and an integer
goal, return indices of the two numbers such that they add up to goal. We assume that each pair
of input array and goal has one and only one solution, and you cannot use the same element twice.
Example 1:
• Input: array = [2,2], goal = 4
• Output: [0,1]
• Explanation: Because array + array = 4, we return [0, 1].
Example 2:
• Input: array = [2,3,11,15], goal = 5
• Output: [0,1]
• Explanation: Because array + array = 5, we return [0, 1].
Q2. Numpy Crash [40 points]
The aim is to guide you to know the functionality of Numpy.
Installation. Please install Numpy and show your Numpy version in a screenshot.
Task. Please solve 20 problems in numpy.py. Many only need one-line code.
X-1
in the write-up.
Q3. SciPy Crash [10 points]
The aim is to guide you to know the functionality of SciPy.
Installation. Please install SciPy and show your SciPy version in a screenshot.
Task. Please solve 5 problems in scipy.py. Many only need one-line code.
the write-up.
Q4. Matplotlib Crash [10 points]
The aim is to guide you to know the functionality of Matplotlib.
Installation. Please install Matplotlib and show your Matplotlib version in a screenshot.
version and results of function w1-w5 in the write-up.
Q5. Introduction to Pytorch [20 points]
The aim is to guide you to know the functionality of Pytorch.
Installation. Please install Pytorch and show your Pytorch version in a screenshot.
• Read the demo code and fill in the blank noted by “”” xxx here “”” in pytorch.py
• Vary the training epoch as 1, 2, 4, 8, 16 and plot the accuracy of the “plane” category as a
function of the training epoch.
• Vary the learning rate as [10−5
, 10−4
, 10−3
, 10−2
, 10−1
, 1] and plot the accuracy of the “ship”
category as a function of the learning rate.
• Let’s try another loss function: Mean Squared Error(MSE loss). Compare the performances. Homework 2: Python Programming