0% found this document useful (0 votes)
37 views50 pages

Intro To AI With Python

Uploaded by

Kalighat Okira
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
37 views50 pages

Intro To AI With Python

Uploaded by

Kalighat Okira
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 50

Artificial Intelligence with

Python

Prof. Shibdas Dutta,


Associate Professor,
DCG DATA CORE SYSTEMS INDIA PVT LTD
Kolkata
Abbreviations
AI  Artifical Intelligence
ML  Machine Learning
NN  Neural Network
IP  Image Processing
CNN  Convolution Neural Network
DL  Deep Learning
DNN  Deep Neural Network
ANN  Artifical Neural Network
AI (ML) – Human Brain
Human Organ – AI Tools
Eye  Camera
Nose  Sensor
Ear  MIC, Mircrophone
Mouth  Speaker
Tongue (Taste)  Sensors
Hands & Legs  Motors (Robotics)
Emotions  Software
AI – Basics
Father of Artificial Intelligence is John McCarthy.
The science and engineering of making intelligent
machines, especially intelligent computer programs.
Artificial Intelligence is a way of making a
computer, a computer-controlled robot, or a software
think intelligently, in the similar manner the intelligent
humans think.
AI is accomplished by studying how human brain
thinks and how humans learn, decide, and work while
trying to solve a problem, and then using the outcomes
of this study as a basis of developing intelligent
software and systems.
Concepts in AI
 Machine Learning
NLTK Package (Natural Language Toolkit Package) ,
NLP(Natural Language Processing)
 Speech Recognition
 Heuristic Search
 Gaming
 Neural Networks
 Genetic Algorithms
 Computer Vision
 Deep Learning
 Robotics
Good Qualities of Human & AI
Human is good with emotions, thinking and can
perform huge number of activities with the support of
all the external organs.
Machines  lifting 1000 kg weight (JCB),
AI  JCB (Robotics) with camera, emotions
(sensors and SW), Speaker to tell about issues.
Human - AI
AI Goal  to create system which can function
Intelligently and Independently.
Human Speak &Listen  Speech Recognition
Write & Read Text  NLP (Natural Language
Processing).
See with Eyes, Process, Recognize Computer
Vision (Image Processing)
Understand & Move freely  Robotics
Like & Unlike objects grouping and Patterns 
Pattern Recognition (Machine Learning, more data
and dimensions of data)
Human - AI
Brain, Network of Neurons  Neural Network
More complex & deeper  Deep Learning or Deep
Neural Network
Key Points
AI  ML, IP, NN, CNN, DS, DL all these topics are
part of AI
AI or ML  Data to train the algorithm.
AI can be protected by Intellectual Property(IPR)
Rights such as patents, copyrights, and trade secrets.
IDE - Software
Anaconda platform
Jupyter Notebook
Idle IDE
Pycharm
Installation of useful packages
pip install numpy
pip install scipy
pip install matplotlib
pip install sklearn
pip install pandas
pip install sys
pip install keras
pip3 install --upgrade tensorflow
Testing of Installed Packages
Numpy
NumPy is an open source library available in Python
that aids in mathematical, scientific, engineering, and
data science programming.
Multi-dimensional arrays and matrices
multiplication.
The library’s name is actually short for "Numeric
Python" or "Numerical Python".
NumPy is memory efficiency, meaning it can handle
the vast amount of data more accessible than any other
library.
scikit-learn

Simple and efficient tools for data mining and data


analysis
Accessible to everbody, and reusable in various
contexts
Built on Numpy, SciPy, and matplotlib
Open source, commercially usable - (Berkeley
Source Distribution) BSD license
Tensorflow
 Developed by Google
 Open Source
The Advantages of TensorFlow are - It has excellent community support, It is
designed to use various backend software (GPUs, Application-Specific Integrated
Circuits(ASIC)), etc. and also highly parallel, It has a unique approach that allows
monitoring the training progress of our models and tracking several metrics, & Its
performance is high and matching the best in the industry.
Graphics processing units (GPUs), originally developed for accelerating graphics
processing, can dramatically speed up computational processes for deep learning. They
are an essential part of a modern artificial intelligence infrastructure, and new GPUs
have been developed and optimized specifically for deep learning.
ASICs (Application-Specific Integrated Circuits) are computer chips that combine
several different circuits all on one chip – it's a "system-on-a-chip" (SoC) design.
There are 4 main tensor type you can create in TensorFlow - tf.Variable, tf.constant,
tf.placeholder, & tf.SparseTensor.
AI - Types
Symbolic Based  Computer Vision, Image
Processing, Camera, Video, Image, Robotics.
Machine Learning  Based on data. Feed machine
with lot of data, so it can learn and perform. (Ex – Lot
of data of Sales versus Advertising spent, then ML can
learn and draw pattern in more than 100 and 1000
dimensions)
ML  Classification & Prediction (Shop Ex –
classifying customers as per data (old / new, age) and
assign toys, and predict their next interest of purchase)
Machine Learning
Machine learning  field of computer science, an
application of artificial intelligence, which provides
computer systems the ability to learn with data and
improve from experience without being explicitly
programmed.
The main focus of machine learning is to allow the
computers learn automatically without human
intervention.
Observations of data  The data can be some
examples, instruction or some direct experiences too.
Then on the basis of this input, machine makes better
decision by looking for some patterns in data.
Data Input types

Excel Data  Numbers and Strings


Images or Videos
Audio Signals
Types of Machine Learning Algorithms

Supervised machine learning algorithms


Unsupervised machine learning algorithms
Reinforcement machine learning algorithms

AI is a combination of complex algorithms


from the various mathematical domains such as
Algebra, Calculus, and Probability and
Statistics.
Supervised machine learning algorithms
This is the most commonly used machine learning
algorithm.
It is called supervised because the process of
algorithm learning from the training dataset can be
thought of as a teacher supervising the learning
process. In this kind of ML algorithm, the possible
outcomes are already known and training data is also
labeled with correct answers.
Supervised machine learning algorithms
Mainly supervised leaning problems can be divided
into the following two kinds of problems −
Classification − A problem is called classification
problem when we have the categorized output such as
“black”, “teaching”, “non-teaching”, etc. (Ex: Classify
all types of flowers, Classify Dolphin or Seahorse)
Regression − A problem is called regression problem
when we have the real value output such as “distance”,
“kilogram”, etc.
Supervised machine learning algorithms
Supervised machine learning algorithms
Supervised - Regression
Regression is one of the most important statistical and
machine learning tools.
It may be defined as the parametric technique that allows us
to make decisions based upon data or in other words allows us
to make predictions based upon data by learning the
relationship between input and output variables. Here, the
output variables dependent on the input variables, are
continuous-valued real numbers.
In regression, the relationship between input and output
variables matters and it helps us in understanding how the
value of the output variable changes with the change of input
variable. Regression is frequently used for prediction of prices,
economics, variations, and so on.
Supervised machine learning algorithms
Gaussian naive bayes
Support Vector Machines (SVM)
Logistic Regression
Random Forest Classifier
K-Nearest Neighbors (KNN) Classifier
Unsupervised machine learning algorithms
algorithms do not have any supervisor to provide
any sort of guidance. That is why unsupervised
machine learning algorithms are closely aligned with
what some call true artificial intelligence.
Suppose we have input variable x, then there will be
no corresponding output variables as there is in
supervised learning algorithms.
In simple words, we can say that in unsupervised
learning there will be no correct answer and no teacher
for the guidance. Algorithms help to discover
interesting patterns in data.
Unsupervised machine learning algorithms
Unsupervised learning problems can be divided into the
following two kinds of problem −
Clustering − In clustering problems, we need to discover the
inherent groupings in the data. The main goal of clustering is
to group the data on the basis of similarity and dissimilarity.
For example, grouping customers by their purchasing
behavior.
Association − A problem is called association problem
because such kinds of problem require discovering the rules
that describe large portions of our data. For example, finding
the customers who buy both x and y.
Unsupervised machine learning algorithms
Unsupervised machine learning algorithms
Unsupervised machine learning algorithms
 K-means clustering algorithm
 Mean Shift clustering Algorithm
Reinforcement machine learning algorithms
These kinds of machine learning algorithms are used
very less.
These algorithms train the systems to make specific
decisions. Basically, the machine is exposed to an
environment where it trains itself continually using the
trial and error method. These algorithms learn from
past experience and try to capture the best possible
knowledge to make accurate decisions.
Markov Decision Process is an example of
reinforcement machine learning algorithms.
Block or Architecture Diagram

Library opencv,
Dataset images sklearn
/ Excel Dataset
Output display
Laptop python Loan available
Algorithm or not
Methodology
• Input Image – Real time Camera / Static Image / Excel
Dataset
• Import Libraries
• Dataset Visualization
• processing of the data
• feature extraction
• Graphical View output
• Split Train and Test Data
• Machine learning Analysis
• Output Prediction
Dataset Analysis
Dataset  Columns are called as  Features, Dimensions,
Attributes, Variables, Parameters etc.
 Balanced or Imbalanced Data.
 Output  Class or Label
 Parameters 
 Check value counts of required parameters (Ex output)
 Fill empty cells with Average value of that parameters.
 Remove empty Cells.
 Remove imbalanced data
 Delete unwanted columns
Preprocessing the Data
ML require formatted data to start the training
process. We must prepare or format data in a certain
way so that it can be supplied as an input to ML
algorithms.
In our daily life, we deal with lots of data but this
data is in raw form. To provide the data as the input of
machine learning algorithms, we need to convert it
into a meaningful data.
In other simple words, we can say that before
providing the data to the machine learning algorithms
we need to preprocess the data.
Preprocessing Steps
Importing the useful packages  import numpy, sklearn,
matplotlib etc.
Example Dataset  online, library or download in excel csv
format.
Binarization  all the values above 0.5(threshold value)
would be converted to 1 and all the values below 0.5 would be
converted to 0.
 Mean Removal
 Scaling
 Normalization
 Labeling the data
 Train data & Test data
Input Image

 When a computer sees an image, it will see an array of pixel


values.
 Let's say we have a color image in JPG form and its size is
480 x 480. The representative array will be 480 x 480 x 3
array of numbers (The 3 refers to RGB values).
 Each of these numbers is given a value from 0 to 255 which
describes the pixel intensity at that point.
Image – Feature Extraction
Color – Pixel Intensity
Shape
Texture
How an Algorithm will Process the
Image
How an Algorithm will Process the
Image
Image Processing Ex

You might also like