0% found this document useful (0 votes)
83 views

JNTUA Python Programming & Data Science - PPT Notes - R20

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

JNTUA Python Programming & Data Science - PPT Notes - R20

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

www.android.universityupdates.in | www.universityupdates.in | https://telegram.

me/jntua

Python

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Python Language
Python is a high level interpreted, interactive,
and object-oriented programming language
created by Guido Rossum in 1989.

Like Perl, Python programming language used


to generate web application and desktops
Graphical User Interface.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Python Language
Python is one of the scripting languages which
were ideally, designed for prototyping of
complex applications.

Python can interface with many OS systems,


libraries and extensible languages like C and
C++..

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Python Language

The top companies in the world like


NASA, Google, YouTube etc works on
Python Programming language for their
web applications.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Introduction to Python

For anyone serious about pursuing and growing in a career in IT, a basic question that roils
the mind is this: which is the best programming language to learn? Most people who want
answers to this question tend to get slightly confused, because they would have heard
about multiple languages, such as Java, Python, PHP, etc. It is in selecting that one truly apt
programming language to learn that the challenge lies.
Even learners who are fully aware of the benefits of most programming languages are in a
fix about choosing the one language they should learn, and also about the best ways to
learn a programming language.
It is very important for the students to make the right choice from the start as it will take a
lot of time and effort to master any given programming language. While selecting any
programming language to learn, students need to consider few aspects such as:
• The difficulty level of a programming language you are willing to learn
• The skills you already know that align with a programming language
• Reasons you want to learn a programming language.
Every programming language has its advantages as well as disadvantages. A language that
is perfectly suited for developing a certain types of applications might not fit for
developing other types.
So, keeping the debate aside of which programming language is good to learn among all,
here in the following discussion we will focus towards understanding what is Python

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

programming language and what are its benefits. At a later stage of this blog, we will
discuss different reasons to learn Python.
In the upcoming discussion we will focus on the following topics:

• What is Python?
• Python 2 VS Python 3
• History of Python
• Features of Python
• Reasons to learn Python in 2020
• Advantages of Python
• Applications of Python.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Initially, let us discuss what is Python

What is Python? This is one of the most asked questions these days in the technology space.
The answer is, Python is one of the powerful programming languages that is high-level, open-
source, and most commonly used for web development, scientific and mathematical
application development, etc.
One of the great advantages of this programming language is it provides excellent library
support and has a large developer community. It also provides easy integration with web
services and GUI-based desktop applications.

 “Did You Know? Python is one of the 9 programming languages that influenced
the design of JavaScript”.
Python is fast, easy-to-use and the most preferred programming language for developing
projects by many companies such as YouTube, Instagram, Pinterest, and Quora, etc. Because
of its excellent features, Python is considered an easy to learn programming language for
beginners and is also sophisticated enough for experienced professionals to use.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Apart from web development and desktop app development, Python is extensively used in
the Data Science field and is used for developing Machine Learning projects. Because of
its huge popularity, many IT professionals are learning this programming language to build
their career as a Python developer.

Python 2 v/s Python 3

Having understood what is Python, let us start exploring the different versions of Python,
such as Python 2 and Python 3. Later we will look at the major differences between them.
Python 2: Python 2 has been the more popular version. This version released in the year
2000 and made the code development process very easy compared to its earlier versions.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Python 2 is a more transparent and inclusive language development process than its earlier
versions.
Python 2 has implemented technical details of Python Enhancement Proposal (PEP). Python
2.7 or Python 2.7.20 is the last version of Python 2 and is no longer under development and
in the year 2020, it will be discontinued.
Different versions of Python and their release dates are as follows:
• Python 2.0 – October 16, 2000
• Python 2.1 – April 17, 2001
• Python 2.2 – December 21, 2001
• Python 2.3 – July 29, 2003
• Python 2.4 – November 30, 2004
• Python 2.5 – November 19, 2006
• Python 2.6 – October 1, 2008
• Python 2.7 – July 3, 2010

Image source: Guru99


Python 3: Python 3 is an improved version. It was released in the year December 2008. This
version was released with the aim of fixing the errors that existed in Python 2. Many
companies are switching towards Python 3 version. This version provides huge library
support.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

CLASSIFICATION

LINEAR CLASSIFICATION NON LINEAR CLASSIFICATION

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

LINEAR CLASSIFICATION

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

LINEAR CLASSIFICATION ALGORITHMS


• Linear Discriminant Classifier
• Naive Bayes
• Logistic Regression

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Linear Discriminant Classifier


Linear Discriminant Analysis (LDA) is used, which reduced the 2D graph into a 1D graph by creating a
new axis. This helps to maximize the distance between the two classes for differentiation.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Naive Bayes:
• It is based on the Bayes Theorem and lies in the domain of Supervised Machine Learning.
• Every feature is considered equal and independent of the others during Classification.
• Naive Bayes indicates the likelihood of occurrence of an event. It is also known as conditional probability.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

The Naive Bayes classifier is based on two essential assumptions:


(i) Conditional Independence - All features are independent of each other. This implies
that one feature does not affect the performance of the other. This is the sole reason behind
the ‘Naive’ in ‘Naive Bayes.’

(ii) Feature Importance - All features are equally important. It is essential to know all the
features to make good predictions and get the most accurate results.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua
Logistic Regression :

→ The model builds a regression model to predict the probability of a given data entry.
→ Similar to linear regression, logistic regression uses a linear function and, in addition, makes use of the 'sigmoid'
function.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Support Vector Machine (linear kernel)


→ It is a straightforward supervised machine learning algorithm used for regression/classification.
→ In the case of SVM, the classifier with the highest score is chosen as the output of the SVM.
→ SVM works very well with linearly separable data but can work for non-linearly separable data as
well.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Non-Linear Classification:
→ Non-Linear Classification refers to categorizing those instances that are not linearly
separable.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Non-Linear Classification Algorithms

• Quadratic Discriminant Classifier


• Multi-Layer Perceptron (MLP):
• Decision Tree:
• K-Nearest Neighbours:
• Random Forest Algorithm:

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Quadratic Discriminant Classifier


→ This technique is similar to LDA(Linear Discriminant Analysis) discussed above.
→ The only difference is that here, we do not assume that the mean and covariance
of all classes are the same.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Multi-Layer Perceptron (MLP):


→ This is nothing but a collection of fully connected dense layers. These help
transform any given input dimension into the desired dimension.
→ It is nothing but simply a neural network.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

→ Itis considered to be one of the most valuable and robust models.


→ Instances are classified by sorting them down from the root to some leaf node

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Hyperparameter
Hyperparameters are the tunable parameters adjusted before running the
training process. These parameters directly affect model performance and help
you achieve faster global minima.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

List of most used hyperparameters:


Learning rate: step size of each iteration and can be set
from 0.1 to 0.0001. In short, it determines the speed at
which the model learns.
Batch size: number of samples passed through a neural
network at a time.
Number of epochs: an iteration of how many times the
model changes weights. Too many epochs can cause
models to overfit and too few can cause models to
underfit, so we have to choose a medium number.
www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua
www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Different Hyperparameter Tuning Methods:

. GridSearch
1

2. RandomSearch
3. Successive Halving
4. Bayesian Optimizers
5. Manual Search
www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua
www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Recurrent Neural Network (RNN)

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Applications of Recurrent Neural Networks:


Image Captioning:
RNNs are used to caption an image by analyzing the
activities present

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Time Series Prediction:


Any time series problem, like predicting the prices of stocks in a particular month, can be
solved using an RNN.

Natural Language Processing:


Text mining and Sentiment analysis can be carried out using an RNN for Natural Language
Processing (NLP).

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Machine Translation:
Given an input in one language, RNNs can be used to translate the input into different languages as output.

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Types of Recurrent Neural Networks:


There are four types of Recurrent Neural
Networks:
One to One
One to Many One to One RNN
Many to One
Many to Many

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

One to Many RNN Many to One RNN Many to Many RNN

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Loss function
 Loss functions are used to estimate and understand how well a
particular algorithm performs.
 The loss function is the function that computes the distance
between the current output of the algorithm and the expected
output.
 It’s a method to evaluate how your algorithm models the data. It
can be categorized into two groups. One
for classification (discrete values, 0,1,2…) and the other
for regression (continuous values).
The most common losses used in Machine learning and Deep
learning is:
Categorical Crossentropy
Binary Crossentropy
Mean Absolute Error
Mean Squared Error

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

What is Convolution Neural Network?


Convolutional Neural Network (CNN) or ConvNets for short is a class of deep
neural networks popularly used for visual data analysis. This visual data can be in the
form of images or videos. CNNs are inspired by the mammalian visual cortex. They were
developed as a computational model for natural visual perception, similar to the human
visual system. The applications of CNN include image classification, object
detection, semantic segmentation, medical image analysis, and many more

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

The basic architecture of a convolutional neural network (CNN) consists of


the following layers:
Convolutional layer — CONV
Activation layer — ACT
Pooling layer — POOL
Fully-connected layer — FC
www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua
www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Long Short Term Memory (LSTM):


LSTMs are a special kind of RNN, capable of learning long-term
dependencies which make RNN smart at remembering things that have happened
in the past and finding patterns across time to make its next guesses make
sense. LSTMs broke records for improved Machine Translation, Language
Modeling and Multilingual Language Processing.

The LSTM networks are popular nowadays. The LSTM network are called
cells and these cells take the input from the previous state ht-1 and current
input xt. The main function of the cells is to decide what to keep in mind and
what to omit from the memory. The past state, the current memory and the
present input work together to predict the next output

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Architecture of LSTM network:

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

There are various gates in the LSTM process

Sigmoid
Forget Gate
Input Gate
Cell State
Output Gate

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Data Science Models

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Applications of Data Science:

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Applications to text in Deep Learnig

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Applications to image in Data Science:

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Image Processing Applications:


This section will describe two commonly used image processing
applications.
YOLO
It is an algorithm that has been widely used in recent years for
computer recognition of objects. Its most important feature is real-time
object recognition. The general average accuracy (MAP) values used in
object recognition are widely used because they are better than others.
SSD
SSD algorithm is used for real-time object detection. However, it uses
optimization methods such as multiscaling and standard boxes to improve
the accuracy drop. With these improvements, SSD tries to match the
accuracy of Faster R-CNN on low resolution images and further increase the
speed.
www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua
www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Applications video in Deep Learning


There are two basic approaches for video-based AI
tasks
1. Single Stream Network:
a. Single frame: a single architecture is used to fuse information from all the frames
at the last stage.
b. Late fusion: two nets with shared params are used. The nets are spaced 15 frams
apart, and combine predictions at the end of the configuration.
c. Early fusion: the combination is performed in the first layer by convolving over 10
frames.
d. Slow fusion: fusion is performed at multiple stages, as a balance between early
and late fusion. Multiple clips are sampled from the entire video and prediction
scores are averaged from the sampled clips in order to perform the final predictions
2. Two Stream Networks
www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua
www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Deep learning-based recommender systems

Convolutional neural networks based recommender systems

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Recurrent neural networks based recommender systems:

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Autoencoder based recommender systems:

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

Neural attention based recommender systems:

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua


www.android.universityupdates.in | www.universityupdates.in | https://telegram.me/jntua

www.android.previousquestionpapers.com | www.previousquestionpapers.com | https://telegram.me/jntua

You might also like