1. Social Media Links
LinkedIn: https://www.linkedin.com/in/karan-shaw
Facebook: https://www.facebook.com/karan.shaw.37
Twitter: https://twitter.com/Karan26659889
Website: https://trybotics.com/about
Karan Shaw
Technical Lead of AI & ML @Nexright,
Founder of Trybotics(IOT & Robotics
Enthusiastic, YouTuber, Tech Trainer &
Speaker)
2.
3. Artificial Intelligence & Machine Learning
Artificial Intelligence (AI) is an area of computer science that emphasizes the
creation of intelligent machines that work and react like humans.
Machine learning is an application of artificial intelligence (AI) that provides systems the ability
to automatically learn and improve from experience without being explicitly programmed.
4. Module 1
1. Introduction to Artificial Intelligence
2. Applications of AI & Current trends
3. Different AI Techniques
4. AI Agents
5. PEAS Analysis
6. Agent Environment Analysis
7. Different Types of AI Agents
8. Machine Learning
9. Introduction and Applications of Machine
Learning
10.Supervised and Unsupervised Learning
11.Classification & Regression Problem
12.Clustering, Anomaly Detection
13.Getting started with Linear Regression
14.Mathematics behind Linear Regression
15.Building Linear Model
16.Gradient Descent Algorithm
17.Error Correction
5. Artificial Intelligence
What is Artificial Intelligence ?
Artificial Intelligence is nothing but the capability of a machine to imitate intelligent human behavior. AI is achieved
by mimicking a human brain, by understanding how it thinks, how it learns, decides, and work while trying to solve
a problem.
6.
7. Applications of AI & Current trends
AI has been dominant in various fields such as:
Gaming − AI plays crucial role in strategic games such
as chess, poker, tic-tac-toe, etc., where machine can
think of large number of possible positions based on
heuristic knowledge.
Natural Language Processing − It is possible to
interact with the computer that understands natural
language spoken by humans.
Expert Systems − There are some applications which
integrate machine, software, and special information to
impart reasoning and advising. They provide explanation
and advice to the users.
Vision Systems − These systems understand, interpret,
and comprehend visual input on the computer. For
example,A spying aeroplane takes photographs, which
are used to figure out spatial information or map of the
areas.
Speech Recognition − Some intelligent systems are
capable of hearing and comprehending the language in
terms of sentences and their meanings while a human
talks to it. It can handle different accents, slang words,
noise in the background, change in human’s noise due to
cold, etc.
Handwriting Recognition − The handwriting recognition
software reads the text written on paper by a pen or on
screen by a stylus. It can recognize the shapes of the
letters and convert it into editable text.
Intelligent Robots − Robots are able to perform the
tasks given by a human. They have sensors to detect
physical data from the real world such as light, heat,
temperature, movement, sound, bump, and pressure.
8. Different AI Techniques
Artificial Neural Networks
Artificial neural networks (ANNs) are biologically inspired computer programs designed to simulate the way
in which the human brain processes information.
Natural Language Processing
Natural language processing (NLP) is a branch of artificial intelligence that helps computers understand,
interpret and manipulate human language.
Natural Language Understanding
Natural-language understanding or natural-language interpretation is a subtopic of natural-language
processing in artificial intelligence
Support Vector Machines
“Support Vector Machine” (SVM) is a supervised machine learning algorithm which can be used for both
classification or regression challenges.
Heuristics
Heuristics are a problem-solving method that uses shortcuts to produce good-enough solutions given a
limited time frame or deadline.
9.
10.
11. Machine Learning and It’s Applications
What is Machine Learning?
Machine Learning is a subset of Artificial Intelligence which provide computers with the ability to learn without
being explicitly programmed. In machine learning, we do not have to define explicitly all the steps or
conditions like any other programming application. The machine gets trained on a training dataset, large
enough to create a model, which helps machine to take decisions based on its learning.
Applications of Machine Learning
Virtual Personal Assistants (Google Assistants, Alexa, Siri)
Social Media Services (Face Detection, Friend Suggestion, New Feed, Advertise)
Email Spam and Malware Filtering (Gmail, Yahoo)
Online Customer Support (Chatbot)
Search Engine Result Refining (Google Search, Bing Search)
Product Recommendations (Amazon.com, Flipkart.com)
Predictions while Commuting ( GPS navigation services)
16. Text to Features (Feature Engineering on text data)
•Syntactic Parsing (Grammar and Part of Speech tags)
•Entity Extraction (Entities as features)
•Statistical Features (Count / Density / Readability Features)
•Word Embedding (Text vectors)
Text Classification
17. Application of NLP
Text Summarization – Given a text article or paragraph, summarize it automatically to
produce most important and relevant sentences in order.
Machine Translation – Automatically translate text from one human language to another
by taking care of grammar, semantics and information about the real world, etc.
Natural Language Generation and Understanding – Convert information from computer
databases or semantic intents into readable human language is called language
generation. Converting chunks of text into more logical structures that are easier for
computer programs to manipulate is called language understanding.
Optical Character Recognition – Given an image representing printed text, determine the
corresponding text.
Document to Information – This involves parsing of textual data present in documents
(websites, files, pdfs and images) to analyzable and clean format.
18. Important NLP Libraries
•Scikit-learn: Machine learning in Python
•Natural Language Toolkit (NLTK): The complete toolkit for all NLP techniques.
•Pattern – A web mining module for the with tools for NLP and machine learning.
•TextBlob – Easy to use NLP tools API, built on top of NLTK and Pattern.
•spaCy – Industrial strength NLP with Python and Cython.
•Gensim – Topic Modelling for Humans
•Stanford Core NLP – NLP services and packages by Stanford NLP Group.
19. Module 2
1. Getting started with python programming.
2. Installing Anaconda
3. Python variables, lists, tuples and dictionaries.
4. Control Structure in Python.
5. Defining Functions in Python.
6. Using modules and packages.
7. NumPy for Data computation.
8. Matplotlib for Data Visualization.
9. Pandas for data exploration.
10.Using scikit-learn.
11.Creating linear regression models using scikit-learn.
20. python
• What is python?
Python is a programming language.
Python can be used on a server to create web applications.
• Download Python from - https://www.python.org/downloads
Check Python version: python --version
• Python is a popular programming language. It was created in 1991 by Guido van
Rossum. What can Python do?
1. Python can be used on a server to create web applications.
2. Python can be used alongside software to create workflows.
3. Python can connect to database systems. It can also read and modify files.
4. Python can be used to handle big data and perform complex mathematics.
5. Python can be used for rapid prototyping, or for production-ready software development.
21. python
First Python Program
• Interactive Mode Programming
>>> print (“Hello, Python!”)
• Script Mode Programming.
1. Create test.py file and write the code-
print (“Hello, Python!”) and save.
2. Then open command prompt and run the
command- python test.py
Why Python?
• Python works on different platforms (Windows, Mac,
Linux, Raspberry Pi, etc).
• Python has a simple syntax similar to the English
language.
• Python has syntax that allows developers to write
programs with fewer lines than some other programming
languages.
• Python runs on an interpreter system, meaning that code
can be executed as soon as it is written. This means that
prototyping can be very quick.
• Python can be treated in a procedural way, an object-
orientated way or a functional way.
Python is a case sensitive programming language.
E.g. Manpower and manpower are two different identifiers in
Python.
22. Installing Anaconda
• What is Anaconda?
Anaconda is a free and open-source distribution of the Python and R
programming languages for scientific computing, that aims to simplify package
management and deployment. Package versions are managed by the
package management system conda.
• Download Anaconda from ->
https://www.anaconda.com/distribution/#download-section
• What can Anaconda do?
1. Quickly download 1,500+ Python/R data science packages
2. Manage libraries, dependencies, and environments with Conda
3. Develop and train machine learning and deep learning models with scikit-learn andTensorFlow,
etc
23. Python Indentations And comments
Indentations
Where in other programming languages the indentation in
code is for readability only, in Python the indentation is
very important.
Python uses indentation to indicate a block of code.
E.g. -
if 5 > 2:
print ("Five is greater than two!")
Comments in Python
• Single Line Comment
# First Comment
print ("Hello, Python") # Second Comment
• Multi Line Comment
"""This is a
multiline docstring."""
print ("Hello, World!")
24. Python Variables
Example1:
x = 5
y = "John"
print(x)
print(y)
Output –
5
John
Example2:
x = "awesome"
print ("Python is " + x)
Output – Python is
awesome
Python Variables
Unlike other programming languages, Python has no
command for declaring a variable.
A variable is created the moment you first assign a value to
it. Python has a simple syntax similar to the English
language.
x = 4 # x is of type int
x = "Sally" # x is now of type str
print(x)
Rules for Python variables:
A variable name must start with a letter or the underscore
character.
A variable name cannot start with a number.
A variable name can only contain alpha-numeric characters
and underscores (A-z, 0-9, and _ ).
Variable names are case-sensitive (age, Age and AGE are
three different variables).
Python Numbers:
1. int
2. float
3. Complex
Output –
<class 'int'>
<class 'float'>
<class 'complex’>
Example:
x = 1 # int
y = 2.8 # float
z = 1j # complex
print(type(x))
print(type(y))
print(type(z))
25. Python list, tuple, Set and dictionary
List:
List is a collection which is ordered and changeable. Allows
duplicate members. In Python lists are written with square
brackets.
Ex- ["apple", "banana", "cherry"]
Tuple:
Tuple is a collection which is ordered and unchangeable.
Allows duplicate members. In Python tuples are written with
round brackets.
Ex- ("apple", "banana", "cherry")
Set:
Set is a collection which is unordered and unindexed. No
duplicate members. In Python sets are written with curly
brackets.
Ex- {"apple", "banana", "cherry"}
Dictionary:
Dictionary is a collection which is unordered, changeable
and indexed. No duplicate members. In Python dictionaries
are written with curly brackets, and they have keys and
values.
Ex- { "brand": “Mi", "model": "Note 7","year": 2019}
26. Control Structure in Python
Control Structure
• A set of actions define the flow of events as decided by
the flow chart.
• In general, statements are executed sequentially. The
first statement in a function is executed first, followed by
the second, and so on.
• There may be a situation when you need to execute a
block of code several number of times.
Loops in Python: In Python, there are three loops:
1. While
2. For
3. Nested
While Loop:
count = 0
while (count < 10):
print ( count )
count = count + 1
print ("Good bye!")
For Loop:
fruits = ['Banana', 'Apple', 'Grapes']
for index in range(len(fruits)):
print (fruits[index])
Nested Loop:
count = 1
for i in range(10):
print (str(i) * i)
for j in range(0, i):
count = count +1
27. Functions in Python
Functions
Functions are a convenient way to divide your code into useful blocks, allowing us to order our code, make it more
readable, reuse it and save some time.
Example:
def add (a, b):
return a + b
c = add(10,20)
print(c)
Output: 30
28. modules and packages
Module
A module is a piece of software that has a specific functionality. For example, when building a ping pong game, one
module would be responsible for the game logic, and
another module would be responsible for drawing the game on the screen. Each module is a different file, which can be
edited separately.
Package
Packages are namespaces which contain multiple packages and modules themselves. They are simply directories, but
with a twist.
Each package in Python is a directory which MUST contain a special file called __init__.py. This file can be empty, and
it indicates that the directory it contains is a Python package, so it can be imported the same way a module can be
imported.
29. NumPy for Data computation
NumPy
NumPy is a core library of Python for Data Science which stands for ‘Numerical Python’. It is used for scientific
computing, which contains a powerful n-dimensional array object and provide tools for integrating C, C++ etc. It can
also be used as multi-dimensional container for generic data where you can perform various Numpy Operations and
special Functions.
NumPy Array: Numpy array is a powerful N-dimensional array object which is in the form of rows and columns. We can
initialize numpy arrays from nested Python lists and access it elements. In order to perform these numpy operations, the
next question which will come in your mind is:
How do I install NumPy?
To install Python NumPy, go to your command prompt and type “pip install numpy”. Once the installation is completed,
go to your IDE (For example: PyCharm) and simply import it by typing: “import numpy as np”
Moving ahead in python numpy tutorial, let us understand what exactly is a multi-dimensional numPy array.
30. NumPy for Data computation
It is said to be two dimensional because it has rows as well as columns. In the above image, we have 3
columns and 4 rows available.
31. NumPy for Data computation
Python NumPy Array v/s List
We use python numpy array instead of a list because of the below three reasons:
1. Less Memory
2. Fast
3. Convenient
The very first reason to choose python numpy array is that it occupies less memory as compared to list.
Then, it is pretty fast in terms of execution and at the same time it is very convenient to work with
numpy. So these are the major advantages that python numpy array has over list.
Example:
import numpy as np
import time
import sys
S= range(1000)
print(sys.getsizeof(5)*len(S))
D= np.arange(1000)
print(D.size*D.itemsize)
32. NumPy for Data computation
Python NumPy Operations
1. ndim:
You can find the dimension of the array, whether it is a two-dimensional array or a single dimensional array. So, let
us see this practically how we can find the dimensions. In the below code, with the help of ‘ndim’ function, I can
find whether the array is of single dimension or multi dimension.
import numpy as np
a = np.array([(1,2,3),(4,5,6)])
print(a.ndim)
2. itemsize:
You can calculate the byte size of each element. In the below code, I have defined a single dimensional array and
with the help of ‘itemsize’ function, we can find the size of each element.
import numpy as np
a = np.array([(1,2,3)])
print(a.itemsize)
33. NumPy for Data computation
Python NumPy Operations
1. dtype:
You can find the data type of the elements that are stored in an array. So, if you want to know the data type of a
particular element, you can use ‘dtype’ function which will print the datatype along with the size. In the below code, I
have defined an array where I have used the same function.
import numpy as np
a = np.array([(1,2,3)])
print(a.dtype)
2. reshape:
Reshape is when you change the number of rows and columns which gives a new view to an object. Now, let us
take an example to reshape the array:
34. NumPy for Data computation
Other Operations
You can perform more operations on NumPy array i.e. addition, subtraction, multiplication and division of the two
matrices.
Example:
import numpy as np
x= np.array([(1,2,3),(3,4,5)])
y= np.array([(1,2,3),(3,4,5)])
print(x+y) # addition
print(x-y) # subtraction
print(x*y) # multiplication
print(x/y) # division
35. Matplotlib for Data Visualization
Matplotlib
Matplotlib is a plotting library used for 2D graphics in python programming language. It can be used in
python scripts, shell, web application servers and other graphical user interface toolkits.
Install Matplotlib: pip install matplotlib
There are several sstoolkits which are available and that extend python matplotlib functionality
1. Basemap: It is a map plotting toolkit with various map projections, coastlines and political boundaries.
2. Cartopy: It is a mapping library featuring object-oriented map projection definitions, and arbitrary point, line,
polygon and image transformation capabilities.
3. Excel tools: Matplotlib provides utilities for exchanging data with Microsoft Excel.
4. Mplot3d: It is used for 3-D plots.
5. Natgrid: It is an interface to the natgrid library for irregular gridding of the spaced data.
36. Matplotlib for Data Visualization
let me show you very basic codes in python matplotlib in order to generate a simple graph:
demo1.py
Types of Plots:
37. Pandas for data exploration
Pandas
Pandas is an important library in Python for data science. It
is used for data manipulation and analysis. It is well suited
for different data such as tabular, ordered and unordered
time series, matrix data etc.
How to install Pandas?
1. Pip: pip install pandas
2. Anaconda: conda install pandas
Pandas is build on the top of NumPy
and Matplotlib
Pandas Operations
Using Python pandas, you can perform a lot of operations
with series, data frames, missing data, group by etc.
38. Pandas for data exploration
In order to perform slicing on data, you need a data frame. Don’t worry, data frame is a 2-dimensional data
structure and a most common pandas object. So first, let’s create a data frame.
import pandas as pd
XYZ_web= {'Day':[1,2,3,4,5,6], "Visitors":[1000, 700,6000,1000,400,350], "Bounce_Rate":[20,20, 23,15,10,34]}
df= pd.DataFrame(XYZ_web)
print(df)
39. Use Case to Analyse Youth Unemployment Data
Problem Statement:
You are given a dataset which comprises of the percentage of unemployed youth globally from 2010 to 2014. You have to use
this dataset and find the change in the percentage of youth for every country from 2010-2011.
40. scikit-learn
Scikit-Learn
Scikit learn is a library used to perform machine learning in Python. Scikit learn is an open source library which is
licensed under BSD and is reusable in various contexts, encouraging academic and commercial use. It provides a
range of supervised and unsupervised learning algorithms in Python. Scikit learn consists popular algorithms and
libraries. Apart from that, it also contains the following packages:
1. NumPy
2. Matplotlib
3. SciPy (Scientific Python)
SciPy is a free and open-source Python library used for scientific computing and technical computing.
Installation: pip install scipy
Learning and Predicting
Next, in Scikit learn, we have used a dataset (sample of 10 possible classes, digits from zero to nine) and we need to
predict the digits when an image is given. To predict the class, we need an estimator which helps to predict the classes
to which unseen samples belong. In Scikit learn, we have an estimator for classification which is a python object that
implements the methods fit(x,y) and predict(T).
41. Creating linear regression models using scikit-learn
This example uses
The only the first feature of the diabetes dataset, in order to illustrate a two-dimensional plot of this regression
technique. The straight line can be seen in the plot, showing how linear regression attempts to draw a straight line that
will best minimize the residual sum of squares between the observed responses in the dataset, and the responses
predicted by the linear approximation.
The coefficients, the residual sum of squares and the variance score are also calculated.
42. Module 3
1. Getting Started with Artificial Neural Networks
2. Introduction to neurons, weights
3. Activation Function
4. Input Layers, Hidden Layers and Output Layers
5. Single layer perceptron Model
6. Multilayer Neural Network
7. Back Propagation Algorithm introduction
8. Programming Neural Network using Python
9. Building Regression models using ANN
10.Classification Examples using ANN
43. Artificial Neural Networks
What is Artificial Neural Network?
An artificial neuron network (ANN) is a
computational model based on the structure
and functions of biological neural networks.
Information that flows through the network
affects the structure of the ANN because a
neural network changes - or learns, in a
sense - based on that input and output.
ANNs are considered nonlinear statistical
data modeling tools where the complex
relationships between inputs and outputs are
modeled or patterns are found.
44. Artificial Neural Networks
Neural Networks consist of the
following components:
An input layer, x
An arbitrary amount of hidden layers
An output layer, ŷ
A set of weights and biases between
each layer, W and b
A choice of activation function for
each hidden layer, σ. In this tutorial,
we’ll use a Sigmoid activation function.
45. Module 4
1. K Nearest Neighbour Models
2. Using KNN for Data Classification
3. Building Models using KNN
4. Support Vector Machine – Applications and Mathematics
5. Using SVM for classification
6. Projects:
a) Character Recognition Algorithm
b) Cancer Diagnostic Algorithm
c) Iris Clustering
46. K Nearest Neighbour Models
What is K-Nearest Neighbour ?
K- Nearest Neighbors or also known as K-NN belong to the family of supervised machine learning
algorithms which means we use labeled (Target Variable) dataset to predict the class of new data point.
The K-NN algorithm is a robust classifier which is often used as a benchmark for more complex classifiers
such as Artificial Neural Network (ANN) or Support vector machine (SVM).
47. Support Vector Machine
Support Vector Machine?
Support Vector Machine” (SVM) is a supervised machine learning algorithm which can be used for
both classification or regression challenges. However, it is mostly used in classification problems. In
this algorithm, we plot each data item as a point in n-dimensional space (where n is number of
features you have) with the value of each feature being the value of a particular coordinate. Then,
we perform classification by finding the hyper-plane that differentiate the two classes very well (look at
the below snapshot).