Saturday, September 14, 2019

Well done!

I'm starting to look a bit more into neural networks.  More to come on that later, but in the deeper parts there are matrices and various calculations.  I noticed that the creators of the numpy package did a really great job in making sure that things are displayed in a nice way that makes it easier to see what is going off.  For example, if we create a matrix with:

(python) x=np.array([[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15]])

when you go to print it out you see:

(python) x
array([[ 1,  2,  3],
       [ 4,  5,  6],
       [ 7,  8,  9],
       [10, 11, 12],
       [13, 14, 15]])

What is really great here is that as the numbers increase in length, the output is shifted so all the columns line up.  Yes, this isn't rocket science genius, but it goes a long way to making things readable and understandable.  In the "computer" world often we just print things out and leave it up to the person to mentally align and figure things out.  I find that people who often do that sort of messy output are people I have to remind that the computer actually works for us, not the other way around.  If we take 10 minutes to make the computer do a bit more work (ex. line up the columns) then it has made things (in this case comprehension) easier for us.  Let the tool do the work for you!

No comments: