MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# How to normalize a matrix in numpy?

# How to normalize a matrix in numpy?

This recipe helps you normalize a matrix in numpy

Normalization is a process of organizing the data in a database to avoid data redundancy, insertion anomaly, update anomaly & deletion anomaly. Many a times, it becomes unavoidable when dealing with large datasets especially image processing.

So this recipe is a short example on how to to normalize matrix in numpy. Let's get started.

```
import numpy as np
```

Let's pause and look at these imports. Numpy is generally helpful in data manipulation while working with arrays. It also helps in performing mathematical operation.

```
df= np.random.random((3,3))
print("Original Array:")
print(df)
```

We have a created a simple 3x3 matrix in form of an array, containing random values.

```
dfmax, dfmin = df.max(), df.min()
df = (df - dfmin)/(dfmax - dfmin)
print(df)
```

For normalization, the calculation follows as subtracting each element by minimum value of matrix and thereby dividing the whole with difference of minimum and maximum of whole matrix.

```
print("After normalization:")
print(df)
```

We are simply trying to print normalized array in here.

Once we run the above code snippet, we will see:

Scroll down the ipython notebook to visualize the output.

In this Kmeans clustering machine learning project, you will perform topic modelling in order to group customer reviews based on recurring patterns.

PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

In this machine learning project, you will uncover the predictive value in an uncertain world by using various artificial intelligence, machine learning, advanced regression and feature transformation techniques.

In this machine learning project, you will develop a machine learning model to accurately forecast inventory demand based on historical sales data.

In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

In this project, we are going to talk about Time Series Forecasting to predict the electricity requirement for a particular house using Prophet.

In this deep learning project, we will predict customer churn using Artificial Neural Networks and learn how to model an ANN in R with the keras deep learning package.

In this project, we are going to work on Sequence to Sequence Prediction using IMDB Movie Review Datasetâ€‹ using Keras in Python.

Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

In this supervised learning machine learning project, you will predict the availability of a driver in a specific area by using multi step time series analysis.