Machine Learning | Deep Learning | Data Science | Web Dev
Image for post
Image for post

Note: The code files will be available at :


Artificial Neural Networks are the traditional neural networks which means that there are more than or equal to one layer between the input and the output layer. This allows for the model to adapt for the non linearity and form complex functions which makes it useful in real life.

This blog post does not covers only the implementation of feed forward or artificial neural network with tensorflow 2 and not the theory part of the artificial neural network.

Image for post
Image for post

Note : The Program files for tensorflow 2 can be found on -

Logistic Regression is used for Classification tasks and This Blog will take you through the implementation of logistic regression using Tensorflow 2. This blog post won’t be covering about the theories regarding logistic regression and theory is a pre-requisite.

Let’s jump to the code part :

1. Importing The Dataset

The Dataset that is used in this example is iris dataset from the sklearn library.
we are importing the dataset and storing it in the form of a pandas dataframe

#importing the libraries
import numpy as np
import tensorflow as tf
import pandas as pd
import matplotlib.pyplot …

Image for post
Image for post

Code files will be available at :

What is Linear Regression ?

Linear regression is basically using a equation of a line to find out the linear relationship between 2 variables. By finding the linear relationship, I mean finding the parameters ( Slope and Intercept).

y = m*x + c
y : dependent variable
x : independent variable
m : slope
c : intercept

Image for post
Image for post

Note : All code files will be available at
This blog post will cover some basic functions that will be repeatedly used a lot in tensorflow 2.


random.normal generates random values of the given shape, which follow normal distribution
and random.uniform generates random values in such a way that probability of choosing any number from the random bunch is almost uniform

#normal distribution
x1 = tf.random.normal(shape=(5,5),mean=0,stddev=1)
#normal distribution
output: tf.Tensor(
[[-1.1473149e+00 5.1616412e-01 -2.8656033e-01 -1.4161720e-03
[ 1.5549400e-01 -1.8609362e+00 7.8299832e-01 -7.3712116e-01
[ 5.6524660e-02 1.0138390e-01 1.2218195e+00 1.2505690e+00
[ 3.6436683e-01 -8.6699528e-01 1.5152076e+00 7.8330201e-01
[-1.2999429e+00 1.3505920e+00 1.0376108e+00 -1.5029492e+00
9.7778231e-01]], …

Image for post
Image for post

What is Tensorlfow ?

Tensorflow is a DeepLearning library which has a lot of inbuilt classes and functions which allow you to perform these complex deep learning matrix multiplications and gradient calculations easily. The main Goal behind tensorflow is to make developing machine learning models easier and get it to a production environment.

Advantages of Tensorflow 2 over The first Version

As everyone already know, The updated version of tensorflow allows the user to create models easily whereas it was quite difficult with tensorflow’s first version.


You could directly use tensorflow from google colab (I prefer this) or type
“pip install tensorflow” for windows users and
“pip3 install tensorflow2” for linux users

Tensor Basics

Tensors are simply n-dimensional arrays. …

Image for post
Image for post


sorry for misspelling network , lol.
All the code files will be available at :

What are RNNs and LSTMs ?

Recurrence Neural Network are great for Sequence data and Time Series Data. Long short-term memory is an artificial recurrent neural network architecture used in the field of deep learning. LSTMs and RNNs are used for sequence data and can perform better for timeseries problems.

An LSTM is an advanced version of RNN and LSTM can remember things learnt earlier in the sequence using gates added to a regular RNN. Both LSTM’s and RNN’s working are similar in PyTorch. So, once we coded the Lstm Part, RNNs will also be easier to understand. …

Image for post
Image for post

Note : All the code files will be available at :

What is Sentiment Analysis ?

Sentiment analysis in simple words is basically analysing how an user feels about an item or any other thing from the user’s activity such as reviews , tweets, etc.

Jumping to Code

  1. Importing the Libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import nltk

2. Downloading NLTK

Use the nltk shell to download the english stopwords.

3. Importing the dataset

df = pd.read_csv('IMDB Dataset.csv')

output :

Image for post
Image for post


Recommender systems are the systems that are designed to recommend things to the user based on many different factors

Pearson’s Correlation Coefficient is a very simple yet effective way to find how 1 variable linearly changes with respect to another. we can use this to our advantage and build a recommender system with this concept

Working of correlation coefficient

Image for post
Image for post

Note: All the code files will be available at :

Going Merry is a chatbot that I created for a pirate recruitment process. It helps in recruitment of pirates all around the world. this answer user’s simple questions regarding the recruitment process, pre-requisites, etc.This same model can also be used for creating chatbots for any organization


A chatbot is a software application used to conduct an on-line chat conversation via text . In this blog post, I will show how to create a Simple Chatbot with tensorflow 2 for your organization.

Dataset Preparation

once, the dataset is built . half the work is already done. the way we structure the dataset is the main thing in chatbot. I have used a json file to create a the dataset. …

Image for post
Image for post

All the code files will be available at :

What is an Outlier ?

Anything that is unusual and deviates from the standard “normal” is called an Anomaly or an Outlier.
Detecting these anomalies in the given data is called as anomaly detection.

For more theoretical information about outlier or anomaly detection, Check out : How Anomaly Detection Works ?

Why do we need to remove outliers or detect them ?

Case 1 : Consider a situation where a big manufacturing company is manufacturing an airplane. An airplane has different parts and we don’t want any parts to behave in an unusual way. these unusual behaviours might be because of various reasons. …

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