Minor error -Complete linear algebra theory and implementation

In Complete linear algebra theory and implementation course, Chapter 12 jupyter notebook
reconstruction error for the matrix diagonalization was computed with (code cell 6)

rmsA = np.sqrt( np.square(np.mean( np.reshape(recondiff,(1,-1)) )) )

square and mean should be changed ; i.e.
rmsA = np.sqrt( np.mean(np.square( np.reshape(recondiff,(1,-1)) )) )

another way would be;
rmsA = np.sqrt( ( recondiff * recondiff).mean() )

Great catch Omer! That is indeed a mistake. It’s correct in the MATLAB code, so… yeah, I have no excuse :wink:

Corrected version is uploading now!

1 Like