Closed at 2pm Monday 30th; can't accept late submissions the results were collected then and whatever was submitted was marked
Remember
Apologies if this is harsh but can't go on with ~5% late every week.
If I don't respond to an email please follow up but remember I need your CIS username!!!
I understand that the assignments can be quite challenging but the scores are very good (85% average) so typically you are 'getting it in the end'.
We're moving onto a new subject today so the 'find a point and shuffle along' methods are finishing; if you never felt you never 'got it' we're starting something new now so I want to lead with concept first .
For plagiarism (from last week), I'm accumulating evidence - be warned.
Lets go through a few examples of what people got wrong with the plots:
Ways to Create NumPy Arrays:
numpy.array()
numpy.zeros()
numpy.ones()
import numpy as np
# From Python Lists
a = np.array([1, 2, 3])
# Zeros Array
b = np.zeros((3,100))
c = np.zeros((10,4))
# Ones Array
d = np.ones((40,4,1000))
Say our numpy array looks like this:
A B C
A B C
A B C
# Assume x is a 3x100 array of zeros
x = np.zeros((3,100))
# Selecting the first row of b
first_row_x = x[0, :]
# Output [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0.]
Say our numpy array looks like this:
A B C
A B C
A B C
# Assume x is a 10x4 array of zeros
x = np.zeros((10,4))
# Selecting the first column of c
first_col_x = x[:, 0]
# Output: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
Applying Functions to Arrays:
numpy
functions
import numpy as np
# Array of ones with a small value
e = np.ones((3,4)) * 0.1
# Applying the natural logarithm to each element of e
log_e = np.log(e)