Wednesday, March 22, 2017

numPy Python module - Revisit

I know that there is a module called 'numPy' in python  from long time before, but I did not care that one much, thinking it is just library for math functions.

If you try to learn Machine learning, then it is important to learn the numPy module as a prerequisite for ML. The calculation in Machine learning functions are build with matrix or column vector manipulations.

I remember that how difficult is it to do matrix manipulations in C programming. Usually it will come as a lab exam in college :-) ( that skill is needed),but if you are really focusing on applications or functionalities , the calculations part should be minimal and easy. Numpy module gives that freedom to focus on the applications part.

from numPy import *

matrix = array([[1,2,3],[3,4,5]])

the above single statement give you a matrix 2 columns and 3 raws.  how cool it is !!!

you can get the matrix dimension with following python statement


Matrix addition - looks so simple as shown below

if you check the data type for 'matrix' you will get the below -

>>> type(matrix)
"<"class numpy.ndarray="">

No comments: