You are on page 1of 59

INDUSTRIAL TRAINING FROM SKILL VERTEX

ON

“ARTIFICIAL INTELLIGENCE”

A report submitted in partial fulfillment of the requirements for award of the degree of
Bachelor of Engineering in Computer Science & Engineering.

Submitted by:

NAME: HANSIKA KOUR

ROLL NO : 85/19

UNIVERSITY ROLL NO : 191303026

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING


M.B.S. COLLEGE OF ENGINEERING AND TECHNOLOGY
BABLIANA, JAMMU– 181101
2022
CERTIFICATE

i
ACKNOWLEDGEMENT

This report is an outstanding prospect to convey my gratitude to those many


people whose timely help and guidance went a long way in finishing my
Industrial Training from commencement to achievement. I would like to
express my sincere thanks to Skill Vertex for their guidance and for providing a
platform to explore the practical knowledge. I am also very grateful to respect
Principal of M.B.S.C.E.T. Jammu, and H.O.D of computer science department
for granting me permission to fulfil our Industrial Training.
Last but not the least I would like to thank my friends, family and all those who
helped me for the completion and deeper understanding of the concept of
performance appraisal. Working on this project has been an enlightening
experience for me.
Finally, I would like to thank God almighty for showering endless
blessings on me, and knowledge and strength to make this work a success. I
would also like to thank my family for their support throughout the course and
for serving as an inspiration always.

HANSIKA KOUR (85/19)

ii
Mahant Bachittar Singh
College of Engineering & Technology, Jammu
A constituent of SantManjit Singh Trust
(Approved by AICTE, Govt. of J&K and Affiliated to University of Jammu)

DECLARATION

I HANSIKA KOUR (85/19) hereby declare that this Industrial

Training Report on “Artificial Intelligence” submitted to the

Department of Computer Science & Engineering in Mahant

Bachittar Singh College of Engineering & Technology is prepared

by me and was not submitted to any other institution for award of

any other degree.

HANSIKA KOUR

85/19

191303026

iii
Babliana, Jeevan Nagar Road, P.O.Miran Sahib, Jammu, J&K (UT) India
#Ph- 0191-2262896 #Fax-0191-2262896, email – principalmbs@rediffmail.com, www.mbscet.edu.in

CONTENTS
Page No
Certificate i

Acknowledgement ii

Declaration iii

List of Figures vi

CHAPTER 1 INTRODUCTION TO ARTIFICIAL 1


INTELLIGENCE
1.1 ARTIFICIAL NTELLIGENCE 1
1.2 HISTORY OF ARTIFICIAL INTELLIGENCE 2
1.3 FOUNDATION OF ARTIFICIAL INTELLIGENCE 3
1.4 TYPES OF ARTIFICIAL INTELLIGENCE 4
1.4.1 ARTIFICIAL NARROW INTELLIGEN 5
1.4.2 ARTIFICIAL GENERAL INTELLIGENCE 5
1.4.3 ARTIFICIAL SUPER INTELLIGENCE 5
1.5 APPLICATIONS OF ARTIFICIAL INTELLIGENCE 5
1.5.1 AI IN ASTRONOMY 6
1.5.2 AI IN HEALTHCARE 6
1.5.3 AI IN GAMING 6
1.5.4 AI IN FINANCE 6
1.5.5 AI IN DATA SECURITY 7
1.5.6 AI IN SOCIAL MEDIA 7
1.5.7 AI IN TRAVEL & TRANSPORT 7
1.5.8 AI IN AUTOMOTIVE INDUSTRY 7
1.5.9 AI IN ROBOTICS 7
1.5.10 AI IN ENTERTAINMENT 8
8

iv
1.5.11 AI IN AGRICULTURE 8
1.5.12 AI IN E-COMMERCE 8
1.5.13 AI IN EDUCATION
9

CHAPTER 2 TOOLS FOR ARTIFICIAL INTELLIGENCE 9


9
2.1 LANGUAGES FOR ARTIFICIAL INTELLIGENCE
2.1.1 PYTHON 10

2.1.2 JAVA 10

2.1.3 PROLOG 10

2.1.4 LISP 11

2.1.5 R 11

2.1.6 JULIA 11

2.1.7 C++ 12

2.2 PYTHON FOR ARTIFICIAL INTELLIGENCE 13

2.3 INSTALLING PYTHON 14

2.4 PYTHON LIBRARIES


16
CHAPTER 3 SUBSETS OF ARTIFICIAL INTELLIGENCE 17

3.1 MACHINE LEARNING 17

3.1.1 MACHINE LEARNING PROCESS 18

3.1.2 TYPES OF MACHINE LEARNING 20

3.2 NATURAL LANGUAGE PROCESSING 21

3.3 DEEP LEARNING 21

3.4 EXPERT SYSTEMS 22

3.5 ROBOTICS 23

3.6 COMPUTER VISION 24

3.7 SPEECH RECOGNITION 25

3.8 NEURAL NETWORKS


26
CHAPTER 4 ALGORITHMS FOR ARTIFICIAL INTELLIGENCE 26
26
4.1 CLASSIFICATION ALGORITHMS
27

v
4.1.1 NAIVE BAYES 28
4.1.2 DECISION TREE 28
4.1.3 RANDOM FOREST 29
4.1.4 SUPPORT VECTOR MACHINES 29
4.1.5 K NEAREST NEIGHBORS 29
4.2 REGRESSION ALGORITHMS 30
4.2.1 LINEAR REGRESSION 30
4.2.2 LOGISTIC REGRESSION 31
4.3 CLUSTERING ALGORITHMS
4.3.1 K-MEANS CLUSTERING 32
32
CHAPTER 5 FUTURE, CONCERNS AND SCOPE OF AI 32
5.1 FUTURE OF ARTIFICIAL INTELLIGENCE 33
5.2 FUTURE IMPACT OF AI IN DIFFERENT SECTORS 33
5.2.1 HEALTHCARE 33
5.2.2 CYBER SECURITY 33
5.2.3 TRANSPORTATION 33
5.2.4 E-COMMERCE 34
5.2.5 EMPLOYMENT
5.3 MYTHS/CONCERNS ABOUT ADVANCED 34

ARTIFICIAL INTELLIGENCE 34

5.3.1 Superintelligence by the year 2100 is not possible. 34

5.3.2 It will replace all human jobs.


5.3.3 Super-intelligent computers will become better 35

than humans at doing anything we can do 35

5.3.4 AI does not require human intervention. 35

5.4 RISKS INVOLVED WITH AI 35

5.4.1 AI is programmed to do something destructive 36

5.4.2 Misalignment between our goals and machines


5.5 AI CAREERS
37
37
38
CHAPTER 6 PROJECT

vi
6.1 INTRODUCTION 38
6.2 ROADMAP OF THE PROJECT 38
6.3 PYTHON LIBRARIES USED IN THE PROJECT 39
6.4 MACHINE LEARNING ALGORITHMS USED IN MODEL 39
6.6 STEPS INVOLVED IN THE PROJECT 43
6.7 COMPLETE CODE FOR THE PROJECT 46
6.8 OUTPUT SCREENSHOTS
6.9 PROJECT CONCLUSION
47
48
Conclusion
Reference

vii
List of Figures

Figure No. Name of Figure Page No.

Fig 1.1 Foundation of AI 4


Fig 1.2 Types of AI 4
Fig 1.3 Applications of AI 6
Fig 2.1 Languages for AI 9
Fig 2.2 Python for AI 12
Fig 2.3 Installing Python 13
Fig 2.4 Installing Python 13
Fig 2.5 Python Setup 14
Fig 2.6 Command Prompt 14
Fig 2.7 Python Libraries 15
Fig 3.1 Subset of AI 16
Fig 3.2 Machine Learning Model 17
Fig 3.3 Types of Machine Learning 18
Fig 3.4 Supervised Machine Learning 18
Fig 3.5 Classification and Regression 19
Fig 3.6 Unsupervised Machine Learning 20
Fig 3.7 Natural Language Processing 20
Fig 3.8 Deep Learning 21
Fig 3.9 Expert Systems 22
Fig 3.10 Robotics 22
Fig 3.11 Computer Vision 23
Fig 3.12 Speech Recognition 24
Fig 3.13 Neural Network 25
Fig 4.1 Algorithms for AI 26
Fig 4.2 Naïve Bayes 27
Fig 4.3 Decision Tree 27
Fig 4.4 Random Forest 28
Fig 4.5 SVM 28
Fig 4.6 KNN 29
Fig 4.7 Linear Regression 30

viii
Fig 4.8 Logistic Regression 30
Fig 4.9 K Means Clustering 31
Fig 5.1 Future of AI 32
Fig 5.2 AI Careers 36
Fig 6.1 Output Screenshot 1 43
Fig 6.2 Output Screenshot 2 43
Fig 6.3 Output Screenshot 3 44
Fig 6.4 Output Screenshot 4 44
Fig 6.5 Output Screenshot 5 45
Fig 6.6 Output Screenshot 6 45

ix
Artificial Intelligence

CHAPTER 1
INTRODUCTION TO ARTIFICIAL INTELLIGENCE

1.1 ARTIFICIAL INTELLIGENCE

According to the father of Artificial Intelligence, John McCarthy, it is “The science and
engineering of making intelligent machines, especially intelligent computer programs”. He
said, ‘Every aspect of learning or any other feature of intelligence can in principle be so
precisely described that a machine can be made to simulate it. An attempt will be made to
find how to make machines use language, form abstractions, and concepts, solve kinds of
problems now reserved for humans, and improve themselves.’

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. Basically, it
is intelligence demonstrated by machines, as opposed to the natural intelligence displayed
by animals including humans. Leading AI textbooks define the field as the study of
"intelligent agents": any system that perceives its environment and takes actions that
maximize its chance of achieving its goals.

Some popular accounts use the term "artificial intelligence" to describe machines that mimic
"cognitive" functions that humans associate with the human mind, such as "learning" and
"problem solving", however, this definition is rejected by major AI researchers. Artificial
intelligence, in its simplest sense, refers to the ability of a computer to perform tasks that are
similar to that of human learning and decision making. The term can also refer to the study,
science, and engineering of such intelligent machines, systems, and programs. 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.
AI Technique is a manner to organize and use the knowledge efficiently in such a way that −
o It should be perceivable by the people who provide it.
o It should be easily modifiable to correct errors.
o It should be useful in many situations though it is incomplete or inaccurate.

Deptt. Of CSE, MBSCET 1


Artificial Intelligence

o AI techniques elevate the speed of execution of the complex program it is equipped


with.

1.2 HISTORY OF ARTIFICIAL INTELLIGENCE


While artificial intelligence is a hot topic today, its history goes back many decades. The
term ‘Artificial intelligence’ was coined by John McCarthy in the year 1956 at Dartmouth
College at the first-ever AI conference. Later that year, JC Shaw, Herbert Simon, and Allen
Newell created the first AI software program named ‘Logic Theorist.’

Although, the idea of a ‘machine that thinks’ dates back to the Mayan civilization. In the
modern era, there have been some important events since the advent of electronic computers
that played a crucial role in the evolution of AI:

 Maturation of Artificial Intelligence (1943–1952): Walter Pitts and Warren S


McCulloch, two mathematicians, published ‘A Logical Calculus of the Ideas
Immanent in Nervous Activity’ in the Journal of Mathematical Biophysics. They
described the behavior of human neurons with the help of simple logical functions
that inspired an English mathematician Alan Turing to publish ‘Computing
Machinery and Intelligence’ that comprised a test. This Turing Test is used to check a
machine’s ability to exhibit intelligent behavior.
 The birth of Artificial Intelligence (1952–1956): Logic Theorist, the first AI
program was created in the year 1955 by Allen Newell and Herbert A Simon. It
proved around 52 mathematical theorems and improved the proofs for other theorems.
Professor John McCarthy coined the term ’Artificial Intelligence at the Dartmouth
conference, and it was accepted as an academic field.
 Golden years – early enthusiasm (1956–1974): After the invention of high-level
languages such as LISP, COBOL, and FORTRAN, researchers got more excited
about AI and developed algorithms to solve complex mathematical problems. Joseph
Weizenbaum, a computer scientist, created the first chatbot named ‘ELIZA’ in the
year 1966. A year later, Frank Rosenblatt built a computer named ‘Mark 1
Perceptron.’ This computer was based on the biological neural network (BNN) and
learned through the method of trial and error that was later coined as reinforced
learning. In 1972, Japan built the first intelligent humanoid robot named ‘WABOT-1.’

Deptt. Of CSE, MBSCET 2


Artificial Intelligence

Since then, robots are constantly being developed and trained to perform complex
tasks in various industries.
 A boom in AI (1980–1987): The first AI winter (1974–1980) was over, and
governments started seeing the potential of how useful AI systems could be for the
economy and defense forces. Expert systems and software were programmed to
simulate the decision-making ability of the human brain in machines. Al algorithms
like backpropagation, which uses neural networks to understand a problem and find
the best possible solution, were used.
 The AI Winter (1987–1993): By the end of the year 1988, IBM successfully
translated a set of bilingual sentences from English to French. More advancements
were going on in the field of AI and Machine Learning, and by 1989, Yann LeCun
successfully applied the backpropagation algorithm to recognize handwritten ZIP
codes. It took three days for the system to produce the results but was still fast enough
given the hardware limitations at that time.
 The emergence of intelligent agents (1993–2011): In the year 1997, IBM developed
a chess-playing computer named ‘Deep Blue’ that outperformed the world chess
champion, Garry Kasparov, in a chess match, twice. In 2002, Artificial intelligence
for the first time stepped into the domestics and built a vacuum cleaner named
’Roomba.’ By the year 2006, MNCs such as Facebook, Google, and Microsoft started
using AI algorithms and Data Analytics to understand customer behavior and improve
their recommendation systems.
 Deep Learning, Big Data, and Artificial General Intelligence (2011–
Present): With computing systems becoming more and more powerful, it is now
possible to process large amounts of data and train our machines to make better
decisions. Supercomputers take the advantage of AI algorithms and neural
networks to solve some of the most complex problems of the modern world. Recently,
Neuralink, a company owned by Elon Musk, successfully demonstrated a brain–
machine interface where a monkey played the ping pong ball video game from his
mind.

1.3 FOUNDATION OF ARTIFICIAL INTELLIGENCE


Artificial Intelligence is not just a part of computer science even it's so vast and requires lots
of other factors which can contribute to it. To create the AI first we should know that how

Deptt. Of CSE, MBSCET 3


Artificial Intelligence

intelligence is composed, so the Intelligence is an intangible part of our brain which is a


combination of Reasoning, learning, problem-solving perception, language understanding,
etc. To achieve the above factors for a machine or software Artificial Intelligence requires the
following discipline:

o Mathematics

o Biology

o Psychology

o Sociology

o Computer Science

o Neurons Study

o Statistics

Fig:1.1: Foundation of AI

1.4 TYPES OF ARTIFICIAL INTELLIGENCE


These are the three stages through which AI can evolve, rather than the 3 types of Artificial
Intelligence.

Deptt. Of CSE, MBSCET 4


Artificial Intelligence

Fig:1.2: Types of AI

1.4.1 ARTIFICIAL NARROW INTELLIGENCE


Narrow AI is a type of AI which is able to perform a dedicated task with intelligence. The
most common and currently available AI is Narrow AI in the world of Artificial Intelligence.
Narrow AI cannot perform beyond its field or limitations, as it is only trained for one specific
task. Hence it is also termed as weak AI. Narrow AI can fail in unpredictable ways if it goes
beyond its limits.
Apple Siri is a good example of Narrow AI, but it operates with a limited pre-defined range
of functions. IBM's Watson supercomputer also comes under Narrow AI, as it uses an Expert
system approach combined with Machine learning and natural language processing. Some
Examples of Narrow AI are playing chess, purchasing suggestions on e-commerce site, self-
driving cars, speech recognition, and image recognition.

1.4.2 ARTIFICIAL GENERAL INTELLIGENCE


General AI is a type of intelligence which could perform any intellectual task with efficiency
like a human. The idea behind the general AI to make such a system which could be smarter
and think like a human by its own. Currently, there is no such system exist which could come
under general AI and can perform any task as perfect as a human.
The worldwide researchers are now focused on developing machines with General AI.
As systems with general AI are still under research, and it will take lots of efforts and time to
develop such systems.

1.4.3 ARTIFICIAL SUPER INTELLIGENCE

Super AI is a level of Intelligence of Systems at which machines could surpass human


intelligence, and can perform any task better than human with cognitive properties. It is an
outcome of general AI. Some key characteristics of strong AI include capability include the
ability to think, to reason, solve the puzzle, make judgments, plan, learn, and communicate by
its own. Super AI is still a hypothetical concept of Artificial Intelligence. Development of
such systems in real is still world changing task.

1.5 APPLICATIONS OF ARTIFICIAL INTELLIGENCE

Deptt. Of CSE, MBSCET 5


Artificial Intelligence

Artificial Intelligence has various applications in today's society. It is becoming essential for
today's time because it can solve complex problems with an efficient way in multiple
industries, such as Healthcare, entertainment, finance, education, etc. AI is making our daily
life more comfortable and faster.

Following are some sectors which have the application of Artificial Intelligence:

Fig:1.3: Applications of AI

1.5.1 AI in Astronomy
Artificial Intelligence can be very useful to solve complex universe problems. AI technology
can be helpful for understanding the universe such as how it works, origin, etc.

1.5.2 AI in Healthcare
In the last, five to ten years, AI becoming more advantageous for the healthcare industry and
going to have a significant impact on this industry. Healthcare Industries are applying AI to
make a better and faster diagnosis than humans. AI can help doctors with diagnoses and can
inform when patients are worsening so that medical help can reach to the patient before
hospitalization.

1.5.3 AI in Gaming
AI can be used for gaming purpose. The AI machines can play strategic games like chess,
where the machine needs to think of a large number of possible places.

Deptt. Of CSE, MBSCET 6


Artificial Intelligence

1.5.4 AI in Finance
AI and finance industries are the best matches for each other. The finance industry is
implementing automation, chatbot, adaptive intelligence, algorithm trading, and machine
learning into financial processes.

1.5.5 AI in Data Security


The security of data is crucial for every company and cyber-attacks are growing very rapidly
in the digital world. AI can be used to make your data more safe and secure. Some examples
such as AEG bot, AI2 Platform, are used to determine software bug and cyber-attacks in a
better way.

1.5.6 AI in Social Media


Social Media sites such as Facebook, Twitter, and Snapchat contain billions of user profiles,
which need to be stored and managed in a very efficient way. AI can organize and manage
massive amounts of data. AI can analyze lots of data to identify the latest trends, hashtag, and
requirement of different users.

1.5.7 AI in Travel & Transport


AI is becoming highly demanding for travel industries. AI is capable of doing various travel
related works such as from making travel arrangement to suggesting the hotels, flights, and
best routes to the customers. Travel industries are using AI-powered chatbots which can
make human-like interaction with customers for better and fast response.

1.5.8 AI in Automotive Industry


Some Automotive industries are using AI to provide virtual assistant to their user for better
performance. Such as Tesla has introduced Tesla Bot, an intelligent virtual assistant. Various
Industries are currently working for developing self-driven cars which can make your journey
more safe and secure.

1.5.9 AI in Robotics:
Artificial Intelligence has a remarkable role in Robotics. Usually, general robots are
programmed such that they can perform some repetitive tasks, but with the help of AI, we can

Deptt. Of CSE, MBSCET 7


Artificial Intelligence

create intelligent robots which can perform tasks with their own experiences without pre-
programmed.

Humanoid Robots are best examples for AI in robotics, recently the intelligent Humanoid
robot named as Erica and Sophia has been developed which can talk and behave like humans.

1.5.10 AI in Entertainment
We are currently using some AI based applications in our daily life with some entertainment
services such as Netflix or Amazon. With the help of ML/AI algorithms, these services show
the recommendations for programs or shows.

1.5.11 AI in Agriculture
Agriculture is an area which requires various resources, labor, money, and time for best
result. Now a day's agriculture is becoming digital, and AI is emerging in this field.
Agriculture is applying AI as agriculture robotics, solid and crop monitoring, predictive
analysis. AI in agriculture can be very helpful for farmers.

1.5.12 AI in E-commerce
AI is providing a competitive edge to the e-commerce industry, and it is becoming more
demanding in the e-commerce business. AI is helping shoppers to discover associated
products with recommended size, color, or even brand.

1.5.13 AI in education:
AI can automate grading so that the tutor can have more time to teach. AI chatbot can
communicate with students as a teaching assistant. AI in the future can be work as a personal
virtual tutor for students, which will be accessible easily at any time and any place.

Deptt. Of CSE, MBSCET 8


Artificial Intelligence

CHAPTER 2
TOOLS FOR ARTIFICIAL INTELLIGENCE

2.1 LANGUAGES FOR ARTIFICIAL INTELLIGENCE


With the advancements in machine learning, data analytics, and conversational AI,
companies are finding it feasible and affordable to deploy AI tools that allow them to solve
problems and increase efficiency. Building an AI solution not only requires a clear set of
requirements but also the right selection of technologies and AI programming languages that
make AI development practically possible and smooth. 

Following are some of the most popular AI programming languages for building
Advanced AI solutions:

Fig:2.1 : Languages for AI

o Python

o R

o Lisp

o Java

o C++

o Julia

Deptt. Of CSE, MBSCET 9


Artificial Intelligence

o Prolog

2.1.1 Python
Python is one of the most powerful and easy programming languages that anyone can start to
learn. Python is initially developed in the early stage of 1991. Most of the developers and
programmers choose Python as their favorite programming language for developing Artificial
Intelligence solutions. Python is worldwide popular among all developers and experts
because it has more career opportunities than any other programming language.

Python also comes with some default sets of standards libraries and also provides better
community support to its users. Further, Python is a platform-independent language and also
provides an extensive framework for Deep Learning, Machine Learning, and Artificial
Intelligence. Python is also a portable language as it is used on various platforms such
as Linux, Windows, Mac OS, and UNIX.

2.1.2 Java
Java is also the most widely used programming language by all developers and programmers
to develop machine learning solutions and enterprise development. Similar to Python, Java is
also a platform-independent language as it can also be easily implemented on various
platforms.

2.1.3 Prolog
Prolog is one of the oldest programming languages used for Artificial Intelligence solutions.
Prolog stands for "Programming in Logic", which was developed by French scientist Alain
Colmerauer in 1970.

For AI programming in Prolog, developers need to define the rules, facts, and the end goal.
After defining these three, the prolog tries to discover the connection between them.
Programming in AI using Prolog is different and has several advantages and disadvantages.

2.1.4 Lisp

Lisp has been around for a very long time and has been widely used for scientific research in
the fields of natural languages, theorem proofs, and to solve artificial intelligence problems.
Lisp was originally created as a practical mathematical notation for programs but eventually

Deptt. Of CSE, MBSCET 10


Artificial Intelligence

became a top choice of developers in the field of AI. Although Lisp programming language is
the second oldest language after Fortran, it is still being used because of its crucial features.
The inventor of LISP programming was John McCarthy, who coined the term Artificial
Intelligence.

LISP is one of the most efficient programming languages for solving specific problems.
Currently, it is mainly used for machine learning and inductive logic problems. It has also
influenced the creation of other programming languages for AI, and some worth examples
are R and Julia.

However, though being so flexible, it has various deficiencies, such as lack of well-known
libraries, not so-human-friendly syntax, etc. Due to this reason, it is not preferred by the
programmers.

2.1.5 R

R is one of the great languages for statistical processing in programming. However, R
supports free, open-source programming language for data analysis purposes. It may not be
the perfect language for AI, but it provides great performance while dealing with large
numbers.Some inbuilt features such as built-in functional programming, object-oriented
nature, and vectorial computation make it a worthwhile programming language for AI.

2.1.6 Julia

Julia is one of the newer languages on the list and was created to focus on performance
computing in scientific and technical fields. Julia includes several features that directly apply
to AI programming.

Julia is a comparatively new language, which is mainly suited for numerical analysis and
computational science. It contains several features that can be very helpful in AI
programming.

Deptt. Of CSE, MBSCET 11


Artificial Intelligence

2.1.7 C++

C++ language has been present for so long around, but still being a top and popular
programming language among developers. It provides better handling for AI models while
developing.

Although C++ may not be the first choice of developers for AI programming, various
machine learning and deep learning libraries are written in the C++ language. C++ is one of
the fastest languages, and it can be used in statistical techniques. It can be used with ML

algorithms for fast execution. Most of the libraries and packages available for Machine
learning and AI are written in C++. It is a user friendly and simple language.

2.2 PYTHON FOR ARTIFICIAL INTELLIGENCE

Python is a high-level, general-purpose and a very popular programming language. Python is


an ideal programming language used for Machine Language, Natural Processing Language
(NLP), and Neural networks, etc. Due to the flexible nature of Python, it can be used for AI
development. It contains various pre-existing libraries such as Pandas, SciPy and nltk, etc.
Further, Python also contains simple syntax and easy coding, which makes Python the first
choice of AI developers and programmers.

Fig:2.2: Python for AI

Python is one of the most popular programming languages and the most beginner’s
friendly around the globe. Python can be used for AI for various following reasons:

Deptt. Of CSE, MBSCET 12


Artificial Intelligence

 Python has Prebuilt Libraries like Numpy for scientific computation, Scipy for
advanced computing and Pybrain for machine learning (Python Machine Learning)
making it one of the best languages For AI.

 Python developers around the world provide comprehensive support and assistance
via forums and tutorials making the job of the coder easier than any other popular
languages.

 Python is platform Independent and is hence one of the most flexible and popular
choices for use across different platforms and technologies with the least tweaks in
basic coding.

 Python is the most flexible of all others with options to choose between OOPs
approach and scripting. You can also use IDE itself to check for most codes and is a
boon for developers struggling with different algorithms.

2.3 INSTALLING PYTHON

If you don’t already have a copy of Python installed on your computer, you will need to open
up your Internet browser and go to the Python download page
(http://www.python.org/download/).

Fig:2.3: Installing Python

Double-click the executable file, which is downloaded; the following window will open.
Select Customize installation and proceed. Click on the Add Path check box, it will set the
Python path automatically.

 Run the Python Installer once downloaded. (In this example, we have downloaded Python
3.9.4)

Deptt. Of CSE, MBSCET 13


Artificial Intelligence

 Make sure you select the “Install launcher for all users” and “Add Python 3.10.2 to PATH”
checkboxes.
 Select install now — the recommended installation options.

Fig:2.4: Installing Python

Fig:2.5: Python Setup

To check if Python 3.9.4 has been successfully installed in our system

 Open Cmd prompt in your system


 Run “ Python -V”

Fig:2.6: Command Prompt

2.4 PYTHON LIBRARIES

Deptt. Of CSE, MBSCET 14


Artificial Intelligence

A Python library is a collection of related modules. It contains bundles of code that can be
used repeatedly in different programs. It makes Python Programming simpler and convenient
for the programmer. Python libraries play a very vital role in fields of Machine Learning,
Data Science, Data Visualization, etc.

Some of the most common python libraries used in AI are given below:

 Tensor Flow Python: Tensor Flow is an end-to-end open source platform for
machine learning. It has a comprehensive, flexible ecosystem of tools, libraries and
community resources that lets researchers push the state-of-the-art in ML and
developers easily build and deploy ML powered applications. Currently, the most
famous deep learning library in the world is Google’s Tensor Flow. Google product
uses machine learning in all of its products to improve the search engine, translation,
image captioning or recommendations.
 Keras Python: Keras is an API designed for human beings, not machines. Keras
follows best practices for reducing cognitive load: it offers consistent & simple APIs,
it minimizes the number of user actions required for common use cases, and it
provides clear & actionable error messages. It also has extensive documentation and
developer guides.
 Scikit-learn Python: Scikit-learn (Sklearn) is the most useful and robust library for
machine learning in Python. It provides a selection of efficient tools for machine
learning and statistical modeling including classification, regression, clustering and
dimensionality reduction via a consistence interface in Python. This library, which is
largely written in Python, is built upon NumPy, SciPy and Matplotlib.
 NumPy Python: Numpy is a general-purpose array-processing package. It provides a
high-performance multidimensional array object, and tools for working with these
arrays. It is the fundamental package for scientific computing with Python.
Besides its obvious scientific uses, Numpy can also be used as an efficient multi-
dimensional container of generic data.
 Python Pandas: Pandas is an open-source library that is made mainly for working
with relational or labelled data both easily and intuitively. It provides various data
structures and operations for manipulating numerical data and time series. This library
is built on top of the NumPy library. Pandas is fast and it has high performance &
productivity for users.

Deptt. Of CSE, MBSCET 15


Artificial Intelligence

Fig:2.7: Python Libraries

CHAPTER 3
SUBSETS OF ARTIFICIAL INTELLIGENCE

Artificial Intelligence works with large amounts of data that are first combined with the fast,
iterative processing and smart algorithms that allow the system to learn from the patterns
within the data. This way, the system would be able to deliver accurate or close to accurate
outputs. As it sounds, It is a vast subject, and the scope of AI is very wide which involves
much-advanced and complex processes, and it is a field of study that includes many theories,
methods, and technologies. The major subfields under AI are:

o Machine Learning
o Deep Learning

o Natural Language processing

o Expert System

o Robotics

o Machine Vision

o Speech Recognition

Deptt. Of CSE, MBSCET 16


Artificial Intelligence

Fig:3.1: Subset of AI

3.1 MACHINE LEARNING


Machine learning provides computer systems the ability to learn with data and improve from
experience without being explicitly programmed. It is primarily concerned with the design
and development of algorithms that allow the system to learn from historical data. Machine
Learning is based on the idea that machines can learn from past data, identify patterns, and
make decisions using algorithms. Machine learning algorithms are designed in such a way
that they can learn and improve their performance automatically. Machine learning helps in
discovering patterns in data.

3.1.1 MACHINE LEARNING PROCESS

A Machine Learning system learns from historical data, builds the prediction models, and
whenever it receives new data, predicts the output for it. The accuracy of predicted output
depends upon the amount of data, as the huge amount of data helps to build a better model
which predicts the output more accurately. In Machine Learning the dataset is divided into 2
parts.

 Training dataset
 Test dataset

While training the model, data is usually split in the ratio of 80:20 i.e. 80% as training data
and rest as testing data. In training data, we feed input as well as output for 80% of data. The

Deptt. Of CSE, MBSCET 17


Artificial Intelligence

model learns from training data only. We use different machine learning algorithms to build
our model. Once the model is ready then it is good to be tested. At the time of testing, the
input is fed from the remaining 20% data which the model has never seen before, the model
will predict some value and we will compare it with actual output and calculate the accuracy.

Fig:3.2: Machine Learning Model

3.1.2 Types of Machine Learning

Fig:3.3: Types of Machine Learning

Machine learning can be subdivided into the main three types:

o Supervised Learning:

Supervised learning is when the model is getting trained on a labelled dataset, and on that basis, it
predicts the output. A labelled dataset is one that has both input and output parameters. The system
creates a model using labeled data to understand the datasets and learn about each data, once the
training and processing are done then we test the model by providing a sample data to check whether

Deptt. Of CSE, MBSCET 18


Artificial Intelligence

it is predicting the exact output or not. The goal of supervised learning is to map input data with
the output data. The supervised learning is based on supervision, and it is the same as when a
student learns things in the supervision of the teacher.

Fig:3.4: Supervised Machine Learning

Mainly supervised leaning problems can be divided into the following two kinds of problems:
Classification − Classification models are the type of Supervised Learning techniques, which
are used to generate conclusions from observed values in the categorical form, i.e., output has
defined labels(discrete value) as "male" or "female", etc.
Regression − A problem is called regression problem when we have the real value output
such as “distance”, “kilogram”, etc.

Fig:3.5: Classification and Regression

o Reinforcement learning:
Reinforcement learning is a type of learning in which an AI agent is trained by giving some
commands, and on each action, an agent gets a reward as feedback. Using these feedbacks,
agent improves its performance. Reward feedback can be positive or negative which means

Deptt. Of CSE, MBSCET 19


Artificial Intelligence

on each good action, agent receives a positive reward while for wrong action, it gets a
negative reward.
Reinforcement learning is of two types:
1. Positive Reinforcement learning
2. Negative Reinforcement learning

o Unsupervised learning:

Unsupervised learning is a type of machine learning in which models are trained using unlabeled
dataset and are allowed to act on that data without any supervision. The goal of unsupervised learning
is to find the underlying structure of dataset, group that data according to similarities, and represent
that dataset in a compressed format. In unsupervised learning, the agent needs to learn from
patterns without corresponding output values.

Fig:3.6: Unsupervised Machine Learning


Clustering
A way of grouping the data points into different clusters, consisting of similar data points.
The objects with the possible similarities remain in a group that has less or no similarities
with another group."
Association
Association rule learning is a type of unsupervised learning technique that checks for the
dependency of one data item on another data item and maps accordingly so that it can be
more profitable. It tries to find some interesting relations or associations among the variables
of dataset.

3.2 NATURAL LANGUAGE PROCESSING


NLP stands for Natural Language Processing, which is a part of Computer Science, Human
language, and Artificial Intelligence. It is the technology that is used by machines to
understand, analyze, manipulate, and interpret human's languages.

Natural Language Processing (NLP) refers to AI method of communicating with intelligent


systems using a natural language such as English. Processing of Natural Language is required

Deptt. Of CSE, MBSCET 20


Artificial Intelligence

when you want an intelligent system like robot to perform as per your instructions, when you
want to hear decision from a dialogue based clinical expert system, etc. The field of NLP
involves making computers reform useful tasks with the natural languages humans use. The
input and output of an NLP system can be −Speech Written Text.

Fig:3.7: Natural Language Processing

3.3 DEEP LEARNING


Deep learning is a subset of machine learning which provides the ability to machine to
perform human-like tasks without human involvement. It provides the ability to an AI agent
to mimic the human brain. Deep learning can use both supervised and unsupervised learning
to train an AI agent.

o Deep learning is implemented through neural networks architecture hence also called
a deep neural network.
o Deep learning is the primary technology behind self-driving cars, speech recognition,
image recognition, automatic machine translation, etc.
o The main challenge for deep learning is that it requires lots of data with lots of
computational power.

Deptt. Of CSE, MBSCET 21


Artificial Intelligence

Fig:3.8: Deep Learning

3.3 EXPERT SYSTEMS


An expert system is an application of artificial intelligence. In artificial intelligence, expert
systems are the computer programs that rely on obtaining the knowledge of human experts
and programming that knowledge into a system. Expert systems emulate the decision-making
ability of human experts. These systems are designed to solve the complex problem through
bodies of knowledge rather than conventional procedural code.

One of the examples of an expert system is a Suggestion for the spelling error while typing in
the Google search box. Following are some characteristics of expert systems:

o High performance

o Reliable

o Highly responsive

o Understandable

Fig:3.9: Expert Systems

3.5 ROBOTICS
Robotics is a branch of artificial intelligence and engineering which is used for designing and
manufacturing of robots. Robots are the programmed machines which can perform a series of
actions automatically or semi-automatically.

AI can be applied to robots to make intelligent robots which can perform the task with their
intelligence. AI algorithms are necessary to allow a robot to perform more complex tasks.

Deptt. Of CSE, MBSCET 22


Artificial Intelligence

Nowadays, AI and machine learning are being applied on robots to manufacture intelligent
robots which can also interact socially like humans. One of the best examples of AI in
robotics is Sophia robot.

Fig:3.10 : Robotics

3.6 COMPUTER VISION

Computer vision is a field of artificial intelligence (AI) that enables computers and systems to
derive meaningful information from digital images, videos and other visual inputs — and
take actions or make recommendations based on that information. If AI enables computers to
think, computer vision enables them to see, observe and understand.

Computer vision works much the same as human vision, except humans have a head start.
Human sight has the advantage of lifetimes of context to train how to tell objects apart, how
far away they are, whether they are moving and whether there is something wrong in an
image. Here are a few examples of established computer vision tasks:

 Image classification sees an image and can classify it (a dog, an apple, a person’s


face). More precisely, it is able to accurately predict that a given image belongs to a
certain class. For example, a social media company might want to use it to
automatically identify and segregate objectionable images uploaded by users.

 Object detection can use image classification to identify a certain class of image and
then detect and tabulate their appearance in an image or video. Examples include
detecting damages on an assembly line or identifying machinery that requires
maintenance.

Deptt. Of CSE, MBSCET 23


Artificial Intelligence

 Object tracking follows or tracks an object once it is detected. This task is often


executed with images captured in sequence or real-time video feeds. Autonomous
vehicles, for example, need to not only classify and detect objects such as pedestrians,
other cars and road infrastructure, they need to track them in motion to avoid
collisions and obey traffic laws.

Fig:3.11: Computer Vision

3.7 SPEECH RECOGNITION:

Speech recognition is a technology which enables a machine to understand the spoken


language and translate into a machine-readable format. It can also be said as automatic
Speech recognition and computer speech recognition. It is a way to talk with a computer,
and on the basis of that command, a computer can perform a specific task.

There is some speech recognition software which has a limited vocabulary of words and
phrase. This software requires unambiguous spoken language to understand and perform
specific task. Today's there are various software or devices which contains speech recognition
technology such as Cortana, Google virtual assistant, Apple Siri, etc.

We need to train our speech recognition system to understand our language. In previous days,
these systems were only designed to convert the speech to text, but now there are various
devices which can directly convert speech into commands. Speech recognition systems can
be used in the following areas:

o System control or navigation system

o Industrial application

o Voice dialing system

Deptt. Of CSE, MBSCET 24


Artificial Intelligence

There are two types of speech recognition

1. Speaker Dependent
2. Speaker Independent

Fig:3.12: Speech Recognition

3.8 NEURAL NETWORKS

Neural Networks can be created from at least three layers of neurons: The input layer, the
hidden layer(s) and the output layer. The hidden layer — or layers — in between consist of
many neurons, with connections between the layers. As the neural network “learns” the data,
the weights, or strength, of the connections between these neurons are “fine-tuned,” allowing
the network to come up with accurate predictions.

When a neural network has many layers, it’s called a deep neural network, and the process of
training and using deep neural networks is called deep learning.

Basics of Neural Networks Structure

1) Neuron: Just like a neuron forms the basic element of our brain, a neuron forms the basic
structure of a neural network. In case of a neural network, a neuron receives an input,
processes it and generates an output which is either sent to other neurons for further
processing or it is the final output.

2) Weights – When input enters the neuron, it is multiplied by a weight. For example, if a
neuron has two inputs, then each input will have has an associated weight assigned to it. Deep
neural networks generally refer to particularly complex neural networks. These have more
layers (as many as 1,000) and — typically — more neurons per layer. With more layers and

Deptt. Of CSE, MBSCET 25


Artificial Intelligence

more neurons, networks can handle increasingly complex tasks; but that means they take
longer to train.

Fig:3.13: Neural Network

CHAPTER 4
ALGORITHMS FOR ARTIFICIAL INTELLIGENCE

Artificial Intelligence has grown to have a significant impact on the world. With large
amounts of data being generated by different applications and sources, machine learning
systems can learn from the test data and perform intelligent tasks. 
Artificial Intelligence is the field of computer science that deals with imparting the decisive
ability and thinking the ability to machines. Artificial Intelligence is thus a blend of computer
science, data analytics, and pure mathematics.
All Algorithms perform the same task of predicting outputs given unknown inputs, however,
here data is the key driver when it comes to picking the right algorithm. Different Artificial
Intelligence algorithms can be used to solve a category of problems.

Algorithms can be classified into the following categories:

Deptt. Of CSE, MBSCET 26


Artificial Intelligence

Fig:4.1: Algorithms for AI

4.1 CLASSIFICATION ALGORITHMS


Classification algorithms are part of supervised learning. These algorithms are used to divide
the subjected variable into different classes and then predict the class for a given input. For
example, classification algorithms can be used to classify emails as spam or not. Some of the
commonly used classification algorithms.

4.1.1 Naive Bayes


Naive Bayes algorithm works on Bayes theorem and takes a probabilistic approach, unlike
other classification algorithms. The assumption is that the predictors are independent. In
simple words, it assumes that the presence of a particular feature in a class is unrelated to the
presence of any other feature. The algorithm has a set of prior probabilities for each class.
Once data is fed, the algorithm updates these probabilities to form something known as
posterior probability. The Naïve Bayes model is easy to build and particularly useful for large
data sets.

Fig:4.2: Naïve Bayes

4.1.2 Decision Tree


Decision Tree is a Supervised learning technique. It is a tree-structured classifier, where
internal nodes represent the features of a dataset, branches represent the decision rules and
each leaf node represents the outcome.

Deptt. Of CSE, MBSCET 27


Artificial Intelligence

In a Decision tree, there are two nodes, which are the Decision Node and Leaf Node.
Decision nodes are used to make any decision and have multiple branches, whereas Leaf
nodes are the output of those decisions and do not contain any further branches. The
decisions or the test are performed on the basis of features of the given dataset. It is a
graphical representation for getting all the possible solutions to a problem/decision based on
given conditions.

Fig:4.3: Decision Tree

4.1.3 Random Forest


Random forest works like a group of trees. The input data set is subdivided and fed into
different decision trees. The average of outputs from all decision trees is considered. Random
forests offer a more accurate classifier as compared to Decision tree algorithm. The basic
concept of random forest is that each tree gives a classification and the forest chooses the best
classifications from them.

Fig:4.4: Random Forest

Deptt. Of CSE, MBSCET 28


Artificial Intelligence

4.1.4 Support Vector Machines


Support Vector Machine or SVM is one of the most popular Supervised Learning algorithms,
which is used for Classification as well as Regression problems. However, primarily, it is
used for Classification problems in Machine Learning. The goal of the SVM algorithm is to
create the best line or decision boundary that can segregate n-dimensional space into classes
so that we can easily put the new data point in the correct category in the future. This best
decision boundary is called a hyperplane.

Fig:4.5: SVM

4.1.5 K Nearest Neighbors


K-Nearest Neighbour is one of the simplest Machine Learning algorithms based on
Supervised Learning technique. It is used for both classification and regression of the
problems. It is widely used to solve classification problems. K-NN algorithm stores all the
available data and classifies a new data point based on the similarity. This means when new
data appears then it can be easily classified into a well suite category by using K- NN
algorithm.

Fig:4.6: KNN

Deptt. Of CSE, MBSCET 29


Artificial Intelligence

4.2 REGRESSION ALGORITHMS


Regression algorithms are a popular algorithm under supervised machine learning algorithms.
Regression algorithms can predict the output values based on input data points fed in the
learning system. The main application of regression algorithms includes predicting stock
market price, predicting weather, etc. The most common algorithms under this section are 

4.2.1 Linear regression


It is used to measure genuine qualities by considering the consistent variables. It is the
simplest of all regression algorithms but can be implemented only in cases of linear
relationship or a linearly separable problem. The algorithm draws a straight line between data
points called the best-fit line or regression line and is used to predict new values.
Linear regression is mainly used to estimate the real values based on continuous variable(s).
For example, the total sale of a shop in a day, based on real values, can be estimated by linear
regression.

Fig:4.7: Linear Regression

4.2.2 Logistic Regression


Logistic Regression is a classification algorithm and also known as logit regression. Logistic
regression is mainly used for binary classification. This method allows you to analyze a set of
variables and predict a categorical outcome. Mainly logistic regression is a classification
algorithm that is used to estimate the discrete values like 0 or 1, true or false, yes or no based
on a given set of independent variable. Basically, it predicts the probability hence its output
lies in between 0 and 1. Its primary applications include predicting customer lifetime value,
house values, etc.

Deptt. Of CSE, MBSCET 30


Artificial Intelligence

Fig:4.8: Logistic Regression

4.3 CLUSTERING ALGORITHMS


Clustering is the process of segregating and organizing the data points into groups based on
similarities within members of the group. This is part of unsupervised learning. The main aim
is to group similar items. For example, it can arrange all transactions of fraudulent nature
together based on some properties in the transaction. Below are the most common clustering
algorithms.

4.3.1 K-Means Clustering


It is the simplest unsupervised learning algorithm. The algorithm gathers similar data points
together and then binds them together into a cluster. The clustering is done by calculating the
centroid of the group of data points and then evaluating the distance of each data point from
the centroid of the cluster. Based on the distance, the analyzed data point is then assigned to
the closest cluster. ‘K’ in K-means stands for the number of clusters the data points are being
grouped into. 

Fig:4.9: K Means Clustering

Deptt. Of CSE, MBSCET 31


Artificial Intelligence

CHAPTER 5
FUTURE, CONCERNS AND SCOPE OF AI

Deptt. Of CSE, MBSCET 32


Artificial Intelligence

5.1 FUTURE OF ARTIFICIAL INTELLIGENCE


Undoubtedly, Artificial Intelligence (AI) is a revolutionary field of computer science, which
is ready to become the main component of various emerging technologies like big data,
robotics, and IoT. It will continue to act as a technological innovator in the coming years. In
just a few years, AI has become a reality from fantasy. Machines that help humans with
intelligence are not just in sci-fi movies but also in the real world. At this time, we live in a
world of Artificial Intelligence that was just a story though for some years. We are using AI
technology in our daily lives either unknowingly or knowingly, and somewhere it has become
a part of our life. Ranging from Alexa/Siri to Chatbots, everyone is carrying AI in their daily
routine. The development and evolution of this technology are happening at a rapid pace.
However, it was not as smooth and easy as it seemed to us. It has taken several years and lots
of hard work & contributions of various people to take AI at this stage.

Being so revolutionary technology, AI also deals with many controversies about its future
and impact on Human beings. It may be dangerous, but also a great opportunity. AI will be
deployed to enhance both defensive and offensive cyber operations. Additionally, new means
of cyber-attack will be invented to take advantage of particular vulnerabilities of AI
technology.

5.2 FUTURE IMPACT OF AI IN DIFFERENT SECTORS

Fig:5.1: Future of AI

5.2.1 Healthcare:
AI will play a vital role in the healthcare sector for diagnosing diseases quickly and more
accurately. New drug discovery will be faster and cost-effective with the help of AI. It will
also enhance the patient engagement in their care and also make ease appointment

Deptt. Of CSE, MBSCET 33


Artificial Intelligence

scheduling, bill paying, with fewer errors. However, apart from these beneficial uses, one
great challenge of AI in healthcare is to ensure its adoption in daily clinical practices.

5.2.2 Cyber security:


Undoubtedly, cyber security is a priority of each organization to ensure data security. There
are some predictions that cyber security with AI will have below changes:
o With AI tools, security incidents will be monitored.

o Identification of the origin of cyber-attacks with NLP.


o Automation of rule-based tasks and processes with the help of RPA bots.
However, being a great technology, it can also be used as a threat by attackers. They can use
AI in a non-ethical way by using automated attacks that may be intangible to defend.

5.2.3 Transportation:
The fully autonomous vehicle is not yet developed in the transportation sector, but
researchers are reaching in this field. AI and machine learning are being applied in the
cockpit to help reduce workload, handle pilot stress and fatigue, and improve on-time
performance. There are several challenges to the adoption of AI in transportation, especially
in areas of public transportation. There's a great risk of over-dependence on automatic and
autonomous systems.

5.2.4 E-commerce:
Artificial Intelligence will play a vital role in the e-commerce sector shortly. It will positively
impact each aspect of the e-commerce sector, ranging from user experience to marketing and
distribution of products. We can expect e-commerce with automated warehouse and
inventory, shopper personalization, and the use of chatbots in future.

5.2.5 Employment:
Nowadays, employment has become easy for job seekers and simple for employers due to the
use of Artificial Intelligence. AI has already been used in the job search market with strict
rules and algorithms that automatically reject an employee's resume if it does not fulfil the
requirement of the company. It is hoping that the employment process will be driven by most
AI-enabled applications ranging from marking the written interviews to telephonic rounds in
the future. Apart from above sectors, AI has great future in manufacturing, finance &
banking, entertainment, etc.

Deptt. Of CSE, MBSCET 34


Artificial Intelligence

5.3 MYTHS/CONCERNS ABOUT ADVANCED ARTIFICIAL


INTELLIGENCE

5.3.1 Superintelligence by the year 2100 is not possible.


The reality about the possibility of superintelligence is that currently, we can't determine it. It
may occur in decades, or centuries, or may never, but nothing is confirmed. There have been
several surveys in which AI researchers have been asked how many years from now they
think we will have human-scale AI with at least a 50% chance. All of these surveys have the
same conclusion: The world's leading experts disagree, so we don't know. For example, in
such a survey of AI researchers at the 2015 Puerto Rico AI conference, the (average)
answer was by 2045, but some researchers estimated hundreds of years or more.

5.3.2 It will replace all human jobs.


It's certainly true that the advent of AI and automation has the potential to disrupt labour
seriously - and in many situations, it is already doing just that. However, seeing this as a
straightforward transfer of labour from humans to machines is a vast oversimplification.

With the development of AI, a revolution has come in industries of every sector, and people
fear losing jobs with the increased development of AI. But in reality, AI has come up with
more jobs and opportunities for people in every sector. Every machine needs a human being
to operate it. However, AI has taken over some roles, but it reverts to producing more jobs for
people.

5.3.3 Super-intelligent computers will become better than humans at doing


anything we can do

As discussed above, AI can be divided into three types, Weak AI, which can perform
specific tasks, such as weather Prediction. General AI; Capable of performing the task as a
human can do, Super AI; AI capable of performing any task better than human.

At present, we are using weak AI that performs a particular task and improves its
performance. On the other hand, general AI and Super AI are not yet developed, and
researches are going on. They will be capable of doing different tasks similar to human
intelligence. However, the development of such AI is far away, and it will take years or

Deptt. Of CSE, MBSCET 35


Artificial Intelligence

centuries to create such AI applications. Moreover, the efficiency of such AI, whether it will
be better than humans, is not predictable at the current stage.

5.3.4 AI does not require human intervention.

People also have a misconception that AI does not need any human intervention. But the fact
is that AI is not yet developed to take their own decisions. A machine learning
engineer/specialist is required to pre-process the data, prepare the models, prepare a training
dataset, identify the bias and variance and eliminate them, etc. Each AI model is still
dependent on humans. However, once the model is prepared, it improves its performance on
its own from the experiences.

5.4 RISKS INVOLVED WITH AI

Most of the researchers agree that super AI cannot show human emotions such as Love, hate
or kindness. Moreover, we should not expect an AI to become intentionally generous or
spiteful. Further, if we talk about AI to be risky, there can be mainly two scenarios, which
are:

5.4.1 AI is programmed to do something destructive:

Autonomous weapons are artificial intelligence systems that are programmed to kill. In the
hands of the wrong person, these weapons could easily cause mass casualties. Moreover, an
AI arms race could inadvertently lead to an AI war resulting in mass casualties. To avoid
being dissatisfied with the enemy, these weapons would be designed to be extremely difficult
to "turn off," so humans could plausibly lose control of such a situation. This risk is present
even with narrow AI but grows as levels of AI intelligence and autonomy increase.

5.4.2 Misalignment between our goals and machines:

The second possibility of AI as a risky technology is that if intelligent AI is designed to do


something beneficial, it develops destructive results. For example, Suppose we ask the self-
driving car to "take us at our destination as fast as possible." The machine will immediately
follow our instructions. It may be dangerous for human lives until we specify that traffic rules
should also be followed and we value human life. It may break traffic rules or meet with an
accident, which was not really what we wanted, but it did what we have asked to it. So,

Deptt. Of CSE, MBSCET 36


Artificial Intelligence

super-intelligent machines can be destructive if they ask to accomplish a goal that


doesn't meet our requirements.

5.5 AI CAREERS
Freshers should analyze their competencies and skills and choose a better AI role with the
potential for upward mobility. The future scope of Artificial Intelligence continues to grow
due to new job roles and advancements in the AI field. The various roles in an AI career are
as follows:

Fig:5.2: AI Careers

o AI Analysts and Developers

o AI Engineer and Scientist

o AI researcher

o AI Algorithms Expert

o Robotics specialist

o Military and aviation specialist

o Maintenance and mechanical engineer

o Surgical AI technician

CHAPTER 6
PROJECT

Deptt. Of CSE, MBSCET 37


Artificial Intelligence

Artificial intelligence (AI) is intelligence demonstrated by machines, as opposed to natural


intelligence displayed by animals including humans.

Machine learning is about learning to predict something or extracting knowledge from data.
ML is a part of artificial intelligence. ML algorithms build a model based on sample data or
known as training data and based upon the training data the algorithm can predict something
on new data.

In this project, I have experimented with a real-world dataset, and to explore how machine
learning algorithms can be used to find the patterns in data.

The dataset used was that of an Iris flower. Iris flower classification is a very popular
machine learning project. The iris dataset contains three classes of flowers, Versicolor,
Setosa, Virginica, and each class contains 4 features, ‘Sepal length’, ‘Sepal width’, ‘Petal
length’, ‘Petal width’. The aim of the iris flower classification is to predict flowers based on
their specific features.

6.1 INTRODUCTION
The dataset for this project originates from the UCI Machine Learning Repository. The Iris
flower data set or Fisher's Iris data set is a multivariate data set introduced by the British
statistician and biologist Ronald Fisher in his 1936 paper The use of multiple measurements
in taxonomic problems as an example of linear discriminant analysis.

 The data set consists of 50 samples from each of three species of Iris (Iris setosa, Iris
virginica and Iris versicolor).
 Four features were measured from each sample (in centimeters):
o Length of the sepals
o Width of the sepals

o Length of the petals

o Width of the petals

6.2 ROADMAP OF THE PROJECT


A machine learning project has a number of well-known steps:

1. Define Problem.

Deptt. Of CSE, MBSCET 38


Artificial Intelligence

2. Prepare Data.
3. Evaluate Algorithms.
4. Improve Results.
5. Present Results.

The program takes data from the load_csv(). The program then visualizes and summarizes the
data. Then the dataset is divided into training and testing samples in 80:20 ratio randomly
using train_test_learn() function available in sklearn module.
5 different algorithms are applied and models of the data are created. Predictions are made on
the testing sample space.

Accuracy score is then calculated by comparing with the correct results of the training
dataset.

6.3 PYTHON LIBRARIES USED IN THE PROJECT


o SciPy
o NumPy
o Matplotlib
o Pandas
o Sklearn

6.4 MACHINE LEARNING ALGORITHMS USED IN MODEL

The machine learning algorithms used in the model include:

 Logistic Regression (LR)


 K-Nearest Neighbours (KNN).
 Classification and Regression Trees (CART).
 Gaussian Naive Bayes (NB).
 Support Vector Machines (SVM)

6.5 STEPS INVOLVED IN THE PROJECT


The following steps were followed to complete the project:
1. Load/import the libraries

Deptt. Of CSE, MBSCET 39


Artificial Intelligence

2. Loading the dataset.


3. Summarizing the dataset.
4. Visualizing the dataset.
5. Evaluating some algorithms.
6. Split your dataset into train and test spit.
7. Determine which algorithm gives you the most accurate results/highest accuracy
scores and use that for further computations and building the final model.
8. Making some predictions.

6.6 COMPLETE CODE FOR THE PROJECT


#Importing Libraries
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import classification_report
from sklearn.metrics import accuracy_score
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC

#Loading the dataset


url='https://raw.githubusercontent.com/jbrownlee/Datasets/master/iris.csv'
names = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'class']

Deptt. Of CSE, MBSCET 40


Artificial Intelligence

dataFrame = pd.read_csv(url, names=names)


dataFrame.head()

#Summarizing the Dataset

#dimension of dataset
dataFrame.shape

#display stats about data


dataFrame.describe()

#to display basic info about datatype


dataFrame.info()

#to display no of samples for each class


dataFrame['class'].value_counts()

#check for null values


dataFrame.isnull().sum()

#Data Visualization

#box and whisker plots


dataFrame.plot(kind='box', subplots=True, layout=(2,2), sharex=False, sharey=False)
plt.show()

#histograms
dataFrame['sepal-length'].hist()
plt.show()
dataFrame['sepal-width'].hist()
plt.show()
dataFrame['petal-length'].hist()
plt.show()
dataFrame['petal-width'].hist()

Deptt. Of CSE, MBSCET 41


Artificial Intelligence

plt.show()
#Scatter matrix
pd.plotting.scatter_matrix(dataFrame)
plt.show()

#heatmap
print("Checking the correlation : ")
corr = dataFrame.corr()
fig, ax = plt.subplots(figsize =(5,4))
sns.heatmap(corr, annot=True, ax=ax)
plt.show()

#Splitting the data


X= dataFrame.drop(columns=['class'])
Y= dataFrame['class']
x_train, x_test, y_train, y_test = train_test_split(X,Y,test_size = 0.20,random_state=1)

#Building Models
models = []
models.append(('LR', LogisticRegression(solver='liblinear', multi_class='ovr')))
models.append(('KNN', KNeighborsClassifier()))
models.append(('CART', DecisionTreeClassifier()))
models.append(('NB', GaussianNB()))
models.append(('SVM', SVC(gamma='auto')))

# evaluate each model


results = []
names = []
for name, model in models:
kfold = StratifiedKFold(n_splits=10, random_state=1, shuffle=True)
cv_results = cross_val_score(model, x_train, y_train, cv=kfold, scoring='accuracy')
results.append(cv_results)
names.append(name)
print('%s: %f (%f)' % (name, cv_results.mean(), cv_results.std()))

Deptt. Of CSE, MBSCET 42


Artificial Intelligence

#comparing algorithms and select best model


plt.boxplot(results, labels=names)
plt.title('Algorithm Comparison')
plt.show()

#Make Predictions
model = SVC(gamma='auto')
model.fit(x_train, y_train)
predictions = model.predict(x_test)

#evaluate predictions
print(f'Test Accuracy: {accuracy_score(y_test, predictions)}')
print(f'Classification Report: \n {classification_report(y_test, predictions)}')

6.7 OUTPUT SCREENSHOTS

Deptt. Of CSE, MBSCET 43


Artificial Intelligence

Fig:6.1: Output Screenshot 1

Fig:6.2: Output Screenshot 2

Deptt. Of CSE, MBSCET 44


Artificial Intelligence

Fig:6.3: Output Screenshot 3

Fig:6.4: Output Screenshot 4

Deptt. Of CSE, MBSCET 45


Artificial Intelligence

Fig:6.5: Output Screenshot 5

Fig:6.6: Output Screenshot 6

Deptt. Of CSE, MBSCET 46


Artificial Intelligence

6.8 PROJECT CONCLUSION


In this project, we learned to train our own supervised machine learning model using Iris
Flower Classification Project with Machine Learning.

The following algorithms were used:

• Logistic Regression (LR)


• K-Nearest Neighbours (KNN)
• Classification and Regression Trees (CART)
• Gaussian Naive Bayes (NB)
• Support Vector Machines (SVM)

So, we had 5 models and accuracy estimations for each. We need to compare the models to
each other and select the most accurate. In this case, we can see that it looks like Support
Vector Machines (SVM) has the largest estimated accuracy score at about 0.98 or 98%.
Hence Support Vector Machine is used as the final model.

The model successfully classifies the flower among three species (Setosa, Versicolor, or
Virginica) from sepals' and petals' length and width measurements.

Deptt. Of CSE, MBSCET 47


Artificial Intelligence

CONCLUSION

Artificial intelligence (AI) is on the rise as it is integrated into every aspect of our daily lives;
from computers, video games, and even kitchen appliances. As humans, we have allowed AI to
infiltrate our daily lives as they complete the simplest of task for us, however they are not
completed to the best of their abilities. As humans, we are able to complete a task to the prime
of our capacity through the combination of our experiences, emotions, and logic. On the other
hand, artificial intelligence formulates a conclusion through a series of mathematical equations,
numerous numbers of code, and a series of zeros and ones in order to mimic our human
capabilities of decision making.

In conclusion, artificial intelligence will become more valuable to humans than it’s
capabilities. It will become a part of our daily lives. Some worry about the development of
this new technology where a robot that can learn and develop skills on it’s own. Artificial
intelligence will surpass humans on an IQ level and become better than humans at many
skills or knowledge. This leaves some people in an identity crisis. Why makes humans so
unique and what is their purpose if artificial intelligence can simply replace them by taking
all of their traits and habits? Artificial intelligences are designed to learn on their own and
resemble a human brain and physical and mental properties. One thing is for sure, is that
artificial intelligence will continue to develop because of humans. Humans will continue to
make new discoveries and discover new things. Artificial intelligence will never be able to
accomplish that, however they may assist a human by providing theories. The future is
unknown and maybe artificial intelligence and humans will be able to work together on many
different topics.

Deptt. Of CSE, MBSCET 48


Artificial Intelligence

REFERENCE

 https://www.tutorialspoint.com/artificial_intelligence_overview
 http://www.techsparks.co.in/artificial-intelligence
 https://www.upgrad.com/blog/types of artificial intelligence algorithms
 https://www.javatpoint.com/subsets of ai
 https://existek.com/blog/ai programming languages
 https://www.javatpoint.com/future of artificial intelligence and concerns
 https://en.wikipedia.org/wiki/Artificial_intelligence/Applications
 https://www.analyticsvidhya.com/common-machine-learning-algorithms
 https://www.upgrad.com/blog/top-python-libraries-for-machine-learning
 https://computerscienceai.wordpress.com/conclusion

Deptt. Of CSE, MBSCET 49

You might also like