Normalization of a vector or a matrix is a common operation performed in a variety of scientific, mathematical, and programming applications.
In this tutorial, we will understand what normalization is, and how to compute the same in Python.
We will look at the following topics on normalization using Python NumPy:


NumPy arrays are most commonly used to represent vectors or matrices of numbers.
A 1-dimensional or a 1-D array is used for representing a vector and a 2-D array is used to define a matrix (where each row/column is a vector).

These vectors and matrices have interesting mathematical properties.

Most of you must have to use NumPy random seed during Python coding. Sometimes, we use code repeatedly but don’t exactly know the purpose it serves.

A similar situation is with NumPy random seed. This article is to understand the use of the random seed. And to understand the actual need for random seed and what purpose does it serve.

What is NumPy Random Seed?

As the name signifies, the purpose of random seed is related to random numbers. The syntax mostly used is:

import numpy as npnp.random.seed()

random() is the module offered by the NumPy library in Python to work with random numbers…

In a previous tutorial, we talked about the Depth First Search algorithm where we visit every point from A to B and that doesn’t mean that we will get the shortest path.

In this tutorial, we will implement Dijkstra’s algorithm in Python to find the shortest and the longest path from a point to another.

One major difference between Dijkstra’s algorithm and Depth First Search algorithm or DFS is that Dijkstra’s algorithm works faster than DFS because DFS uses the stack technique, while Dijkstra uses the heap technique which is slower.

Pathfinding Problem

Pathfinding is so prevalent that much of the job…

Depth First Search is a popular graph traversal algorithm. In this tutorial, We will understand how it works, along with examples; and how we can implement it in Python.
We will be looking at the following sections:


Graphs and Trees are one of the most important data structures we use for various applications in Computer Science.
They represent data in the form of nodes, which are connected to other nodes through ‘edges’.

Like other data structures, traversing all the elements or searching for an element in a graph or a tree is one of the fundamental operations that is required…

In this blog, we will go through an important descriptive statistic of multi-variable data called the correlation matrix. We will learn how to create, plot, and manipulate correlation matrices in Python.

We will be looking at the following topics:

1 What is the correlation matrix?
1.1 What is the correlation coefficient?
2 Finding the correlation matrix of the given data
3 Plotting the correlation matrix
4 Interpreting the correlation matrix
5 Adding title and labels to the plot
6 Sorting the correlation matrix
7 Selecting negative correlation pairs
8 Selecting strong correlation pairs (magnitude greater than 0.5) …

Looking up for entries that satisfy a specific condition is a painful process, especially if you are searching it in a large dataset having hundreds or thousands of entries.
If you know the fundamental SQL queries, you must be aware of the ‘WHERE’ clause that is used with the SELECT statement to fetch such entries from a relational database that satisfy certain conditions.

NumPy offers similar functionality to find such items in a NumPy array that satisfy a given Boolean condition through its ‘ where() ‘ function — except that it is used in a slightly different way than the…

Today, we’ll be diving into the topic of exiting/terminating Python scripts! Before we get started, you should have a basic understanding of what Python is and some basic knowledge about its use.

You can use the IDE of your choice, but I’ll use Microsoft’s Linux Subsystem for Windows (WSL) package this time. For more information on that and how you enable it on Windows 10 go here.

Why does Python automatically exit a script when it’s done?

The way Python executes a code block makes it execute each line in order, checking dependencies to import, reading definitions and classes to store in memory, and executing pieces of code in order…

In this tutorial, we will look at various ways of performing matrix multiplication using NumPy arrays. we will learn how to multiply matrices with different sizes together.

Also. we will learn how to speed up the multiplication process using GPU and other hot topics, so let’s get started!

Before we move ahead, it is better to review some basic terminologies of Matrix Algebra.

Basic Terminologies

Vector: Algebraically, a vector is a collection of coordinates of a point in space.
Thus, a vector with 2 values represents a point in a 2-dimensional space. In Computer Science, a vector is an arrangement of numbers…

Cryptography deals with encrypting or encoding a piece of information (in a plain text) into a form that looks gibberish and makes little sense in ordinary language.
This encoded message(also called ciphertext) can then be decoded back into a plain text by the intended recipient using a decoding technique (often along with a private key) communicated to the end-user.

Caesar Cipher is one of the oldest encryption technique that we will focus on in this tutorial, and will implement the same in Python.
Although Caesar Cipher is a very weak encryption technique and is rarely used today, we are doing…

In a previous tutorial, we talked about NumPy arrays and we saw how it makes the process of reading, parsing and performing operations on numeric data a cakewalk. In this tutorial, we will discuss the NumPy loadtxt method that is used to parse data from text files and store them in an n-dimensional NumPy array.

Then we can perform all sorts of operations on it that are possible on a NumPy array.

np.loadtxt offers a lot of flexibility in the way we read data from a file by specifying options such as the data type of the resulting array, how…


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store