edyoda/data-science-complete-tutorial

Some mistakes in 1. Notebook

morosow opened this issue · 0 comments

  1. In 1.4.2 Experiment : Change the value of matrices by Reference adding 10 to elements with even indices is wrong:

Add 10 to all the even indexes in matrix
mat = np.array([[1,2,3],[4,5,6],[7,8,9]])
mat1 = mat[::2,::2]
mat1 += 10

Nice, but it reduces matrix dimension from 3x3 to 2x2

  1. Please, check 1.3.7 Horizontal Matrix splitting :

mat = np.random.randint(0,6,(3,7))
sp1,sp2,sp3 = np.hsplit(mat,[4,6])
print ('Original matrix of shape %s, is \n%s\n'%(mat.shape,mat))
print ('First split of shape %s, is \n%s\n'%(sp1.shape,sp1))
print ('Second split of shape %s, is \n%s\n'%(sp2.shape,sp2))
print ('Third split of shape %s, is \n%s\n'%(sp3.shape,sp3))

Are you sure, that it must be always split on [4,6] indices? If yes, would be better to explain these actions, because it's difficult to understand.