Neural Network Tutorials - Herong's Tutorial Examples - 1.20, by Dr. Herong Yang
NumPy - Python Library for Matrix operations
This section provides a tutorial example on how to install Python 3 NumPy library on macOS computers. NumPy is widely used by Python users for matrix operations required in neural network models.
What Is NumPy? NumPy is an open-source Python library for matrix operations developed initially by Travis Oliphant and now maintained by the NumPy community.
If you want to build neural network models in Python, you should install NumPy and get familiar with its functionalities by following this tutorial. This is because neural network models require lots of matrix operations, which are provided in NumPy.
1. Make sure you have python 3 installed by running the "python3" command in a terminal window:
herong$ python3 --version Python 3.8.0
2. Install NumPy library using the "pip3" (Package Installer for Python 3) command:
herong$ sudo pip3 install numpy Collecting numpy Downloading https://files.pythonhosted.org/packages/... Installing collected packages: numpy Successfully installed numpy-1.19.0
3. Verify NumPy installation by importing "numpy" package, retrieving its version string, and creating a 3x4 matrix of random numbers:
herong$ python3 Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) >>> import numpy as np >>> np.1.20 '1.19.0' >>> np.random.rand(3,4) array([[0.98825753, 0.73001974, 0.01652119, 0.12592153], [0.44776361, 0.36145535, 0.380565 , 0.32035704], [0.61031541, 0.5521491 , 0.70684916, 0.05019113]])
Cool! You have NumPy library ready on your Python 3 environment for matrix operations.
For more readings on NumPy, visit NumPy documentation Website at https://numpy.org/doc/.
Table of Contents