**Numpy array in deep learning ( AI )**

In this post we are going to discuss basic deep learning data handling tool (numpy). we will try to answer some of questions which is generally asked by people that what, why and how to use NUMPY in deep learning.

# What is NUMPY?

Technically speaking it is pythons library which supports large and multi dimensional metrics with a large collection of high level mathematical operations which can be performed on n-dimensional array. Basically you are converting your data in n-dimensional array before fitting into the deep learning models by using NUMPY.

In deep learning first you take your (database) data into pandas and then convert into NUMPY. we use pandas to take data because string and categorical data is handle easily and efficiently . But transferring all data to Deep learning model All data should be in numeric .First we convert all data of pandas into number and then converting our pandas object to Numpy Object.

We Use numpy library because it is used and supported by all major deep learning frameworks such as tensorflow, pytorch ,CNTK . In Pytorch we use tensors but we can directly convert our NUMPY object to tensor using its Tensor function

# Why to use NUMPY ?

We use numpy because it is highly efficient and it is written in assembly language . You can handle n - dimensional arrays in it which is some time called as tensors and vectors . It can handle int and float datatypes . It uses Broadcasting in mathematical operation. Broadcasting means increasing rows and columns with respect to other array to perform successful mathematical operation . Let say you have 1 dimensional array [20] and you want to multiply with two dimensional array [ 9.0 10.0] than first array will be extended as [ 2.0 2.0] to multiple successfully with [ 9.0 10.0 ] . we will explain all this in some other post .

You can also perform all linear operation using NUMPY array . you can perform multiply , divide ,transpose on matrices efficiently which is required in deep learning

Commands used in NUMPY regularly for deep learning is:

## Installation :

!pip install numpy

## Simple Example

import numpy as np

import numpy array in the program

a=np.array([ 1.0,2.0])

Declare Numpy array with default Value

print(a.shape)

You can see shape of numpy array

b=a[0]

You can retrieve numpy array value with indices

a[0]=3.0

You can change Numpy array Data with new data using Indices

print(a)

you can Numpy Array object using regular print Function

print(a.dtype)

you can print data type of numpy array

a+b

adding two numpy array with automatic broadcast if required

np.matmul(a,b)

matrix multiplication of two Numpy Array

# Conclusion

In this post we have seen how NUMPY array is used in deep learning . We have tried to answer some of the basic question about NUMPY in deep learning .