AI Unit 4
AI Unit 4
Unit - 4
LEARNING
▪ Learning-Forms of Learning,
▪ Supervised Learning,
▪ Machine Learning-
▪ Decision Trees,
▪ Regression and Classification with Linear Models,
▪ Artificial Neural Networks,
▪ Support Vector Machines.
▪ Applications of AI-Natural Language Processing,
▪ Text Classification and Information Retrieval,
▪ Speech Recognition,
▪ Image processing and computer vision,
▪ Robotics
Artificial Intelligence and Application
✓ Learning
▪ In the field of artificial intelligence (AI), learning is a fundamental concept and can be broadly categorized into several forms.
▪ Each form of learning is used to solve different types of problems and to develop various capabilities in AI systems.
1. Supervised Learning:
▪ Description: In supervised learning, the AI system is trained on a labeled dataset, which means that each training example is paired with an
output label.
▪ Applications: Common applications include classification (e.g., spam detection, image recognition) and regression (e.g., predicting housing
prices).
▪ Example Algorithms: Linear regression, logistic regression, support vector machines, neural networks.
2. Unsupervised Learning:
▪ Description: Unsupervised learning involves training an AI system on data without labeled responses. The system tries to learn the patterns and
structure from the data.
▪ Applications: It is used for clustering (e.g., customer segmentation), association (e.g., market basket analysis), and dimensionality reduction (e.g.,
principal component analysis).
▪ Example Algorithms: K-means clustering, hierarchical clustering, DBSCAN, autoencoders.
Artificial Intelligence and Application
3. Semi-Supervised Learning:
▪ Description: This form of learning uses both labeled and unlabeled data for training. It is especially useful when labeling data is expensive or
time-consuming.
▪ Applications: It is applied in situations where acquiring a large amount of labeled data is difficult but there is an abundance of unlabeled data.
▪ Example Algorithms: Semi-supervised support vector machines, co-training, transudative SVM.
4. Reinforcement Learning:
▪ Description: In reinforcement learning, an agent learns to make decisions by taking actions in an environment to maximize some notion of
cumulative reward.
▪ Applications: Used in robotics, game playing (e.g., AlphaGo), and autonomous vehicles.
▪ Example Algorithms: Q-learning, deep Q-networks (DQN), policy gradients, deep deterministic policy gradient (DDPG).
5. Self-Supervised Learning:
▪ Description: This approach involves the AI system generating its own labels from the input data. It's a form of unsupervised learning but more
structured.
▪ Applications: Commonly used in natural language processing (e.g., BERT, GPT) and computer vision tasks.
▪ Example Algorithms: BERT, GPT, contrastive learning algorithms.
▪ Is a subset of artificial intelligence (AI) that focuses on the development of algorithms and statistical models that enable computers to perform
tasks without explicit instructions, relying on patterns and inference instead.
Artificial Intelligence and Application
✓ Decision Tree Classification Algorithm
▪ Decision Tree is a Supervised learning technique that can be used for both classification and Regression problems, but mostly it is preferred for
solving Classification problems.
▪ 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.
▪ 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.
▪ It is called a decision tree because, similar to a tree, it starts with the root node, which expands on further branches and constructs a tree-like
structure.
▪ In order to build a tree, we use the CART algorithm, which stands for Classification and Regression Tree algorithm.
▪ A decision tree simply asks a question, and based on the answer (Yes/No), it further split the tree into subtrees.
▪ Root Node : Root node is from where the decision tree starts. It represents the entire dataset, which further gets divided into two or more homogeneous sets.
▪ Leaf Node : Leaf nodes are the final output node, and the tree cannot be segregated further after getting a leaf node.
▪ Splitting : Splitting is the process of dividing the decision node/root node into sub-nodes according to the given conditions.
▪ Branch/Sub Tree: A tree formed by splitting the tree.
▪ Pruning : Pruning is the process of removing the unwanted branches from the tree.
▪ Parent/Child node: The root node of the tree is called the parent node, and other nodes are called the child nodes.
▪ It is simple to understand as it follows the same process which a human follow while making any decision in real-life.
▪ It can be very useful for solving decision-related problems.
▪ It helps to think about all the possible outcomes for a problem.
▪ There is less requirement of data cleaning compared to other algorithms.
✓ Regression
▪ Regression is a statistical approach used to analyze the relationship between a dependent variable (target variable) and one or more independent
variables (predictor variables).
▪ The objective is to determine the most suitable function that characterizes the connection between these variables.
Regression Types
1. Simple Regression
• Used to predict a continuous dependent variable based on a single independent variable.
• Simple linear regression should be used when there is only a single independent variable.
2. Multiple Regression
• Used to predict a continuous dependent variable based on multiple independent variables.
• Multiple linear regression should be used when there are multiple independent variables.
3. Nonlinear Regression
• Relationship between the dependent variable and independent variable(s) follows a nonlinear pattern.
• Provides flexibility in modeling a wide range of functional forms.
Artificial Intelligence and Application
Characteristics of Regression :
▪ Continuous Target Variable: Regression deals with predicting continuous target variables that represent numerical values. Examples include predicting house prices,
forecasting sales figures, or estimating patient recovery times.
▪ Error Measurement: Regression models are evaluated based on their ability to minimize the error between the predicted and actual values of the target variable.
Common error metrics include mean absolute error (MAE), mean squared error (MSE), and root mean squared error (RMSE).
▪ Model Complexity: Regression models range from simple linear models to more complex nonlinear models. The choice of model complexity depends on the complexity
of the relationship between the input features and the target variable.
▪ Overfitting and Underfitting: Regression models are susceptible to overfitting and underfitting.
▪ Interpretability: The interpretability of regression models varies depending on the algorithm used. Simple linear models are highly interpretable, while more complex
models may be more difficult to interpret.
Applications of Regression :
▪ Predicting prices: For example, a regression model could be used to predict the price of a house based on its size, location, and other features.
▪ Forecasting trends: For example, a regression model could be used to forecast the sales of a product based on historical sales data and economic indicators.
▪ Identifying risk factors: For example, a regression model could be used to identify risk factors for heart disease based on patient data.
▪ Making decisions: For example, a regression model could be used to recommend which investment to buy based on market data.
Advantages of Regression :
Disadvantages of Regression :
▪ Assumes linearity
▪ Sensitive to multicollinearity
▪ May not be suitable for highly complex relationships
Artificial Intelligence and Application
Classification:
▪ Classification is a process of finding a function which helps in dividing the dataset into classes based on different parameters.
▪ In Classification, a computer program is trained on the training dataset and based on that training, it categorizes the data into different classes.
▪ The task of the classification algorithm is to find the mapping function to map the input(x) to the discrete output(y).
▪ Example: The best example to understand the Classification problem is Email Spam Detection. The model is trained on the basis of millions of
emails on different parameters, and whenever it receives a new email, it identifies whether the email is spam or not. If the email is spam, then it is
moved to the Spam folder.
Regression:
▪ Regression is a process of finding the correlations between dependent and independent variables.
▪ It helps in predicting the continuous variables such as prediction of Market Trends, prediction of House prices, etc.
▪ The task of the Regression algorithm is to find the mapping function to map the input variable(x) to the continuous output variable(y).
▪ Example: Suppose we want to do weather forecasting, so for this, we will use the Regression algorithm. In weather prediction, the model is trained
on the past data, and once the training is completed, it can easily predict the weather for future days.
▪ In Regression, the output variable must be of continuous nature or real ▪ In Classification, the output variable must be a discrete value.
value.
▪ The task of the regression algorithm is to map the input value (x) with ▪ The task of the classification algorithm is to map the input value(x) with
the continuous output variable(y). the discrete output variable(y).
▪ Regression Algorithms are used with continuous data. ▪ Classification Algorithms are used with discrete data.
▪ In Regression, we try to find the best fit line, which can predict the ▪ In Classification, we try to find the decision boundary, which can divide
output more accurately. the dataset into different classes.
▪ Regression algorithms can be used to solve the regression problems ▪ Classification Algorithms can be used to solve classification problems such
such as Weather Prediction, House price prediction, etc. as Identification of spam emails, Speech Recognition, Identification of
cancer cells, etc.
▪ The regression Algorithm can be further divided into Linear and Non- ▪ The Classification algorithms can be divided into Binary Classifier and
linear Regression. Multi-class Classifier.
Artificial Intelligence and Application
The given figure illustrates the typical diagram of Biological Neural Network.
The typical Artificial Neural Network looks something like the given figure.
Artificial Intelligence and Application
Input Layer:
As the name suggests, it accepts inputs in several different formats provided by the programmer.
Hidden Layer:
The hidden layer presents in-between input and output layers. It performs all the calculations to find hidden features and patterns.
Output Layer:
The input goes through a series of transformations using the hidden layer, which finally results in output that is conveyed using this layer.
The artificial neural network takes input and computes the weighted sum of the inputs and includes a bias. This computation is represented in the form of
a transfer function.
Artificial Intelligence and Application
Advantages of Artificial Neural Network (ANN)
▪ Parallel processing capability:
Artificial neural networks have a numerical value that can perform more than one task simultaneously.
▪ Hardware dependence:
Artificial neural networks need processors with parallel processing power, as per their structure. Therefore, the realization of the equipment
is dependent.
Artificial Intelligence and Application
▪ Afterward, each of the input is multiplied by its corresponding weights ( these weights are the details utilized by the artificial neural networks to solve a
specific problem ).
▪ In general terms, these weights normally represent the strength of the interconnection between neurons inside the artificial neural network.
▪ All the weighted inputs are summarized inside the computing unit.
Artificial Intelligence and Application
▪ 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.
▪ SVM chooses the extreme points/vectors that help in creating the hyperplane.
▪ These extreme cases are called as support vectors, and hence algorithm is termed as Support Vector Machine.
▪ Consider the below diagram in which there are two different categories that are classified using a decision boundary or hyperplane:
Artificial Intelligence and Application
Example:
SVM algorithm can be used for Face detection, image classification, text categorization, etc.
Types of SVM
1. Linear SVM: Linear SVM is used for linearly separable data, which means if a dataset can be classified into two classes by using a single straight
line, then such data is termed as linearly separable data, and classifier is used called as Linear SVM classifier.
2. Non-linear SVM: Non-Linear SVM is used for non-linearly separated data, which means if a dataset cannot be classified by using a straight line,
then such data is termed as non-linear data and classifier used is called as Non-linear SVM classifier.
Artificial Intelligence and Application
Advantages of NLP
▪ NLP helps users to ask questions about any subject and get a direct response within seconds.
▪ NLP offers exact answers to the question means it does not offer unnecessary and unwanted information.
▪ NLP helps computers to communicate with humans in their languages.
▪ It is very time efficient.
▪ Most of the companies use NLP to improve the efficiency of documentation processes, accuracy of documentation, and identify the information from large
databases.
Artificial Intelligence and Application
Disadvantages of NLP
Components of NLP
▪ Natural Language Understanding (NLU) helps the machine to understand and analyze human language by extracting the metadata from content such as
concepts, entities, keywords, emotion, relations, and semantic roles.
▪ NLU mainly used in Business applications to understand the customer's problem in both spoken and written language.
▪ NLU involves the following tasks -
▪ It is used to map the given input into useful representation.
▪ It is used to analyze different aspects of the language.
Artificial Intelligence and Application
▪ Natural Language Generation (NLG) acts as a translator that converts the computerized data into natural language representation.
▪ It mainly involves Text planning, Sentence planning, and Text Realization.
NLU NLG
NLU is the process of reading and interpreting language. NLG is the process of writing or generating language.
It produces non-linguistic outputs from natural language inputs. It produces constructing natural language outputs from non-linguistic inputs.
Artificial Intelligence and Application
✓ Applications of NLP
1. Question Answering
Question Answering focuses on building systems that automatically answer the questions asked by humans in a natural
language.
2. Spam Detection
Spam detection is used to detect unwanted e-mails getting to a user's inbox.
3. Sentiment Analysis
Sentiment Analysis is also known as opinion mining. It is used on the web to analyze the attitude, behavior, and emotional state of the sender. This
application is implemented through a combination of NLP (Natural Language Processing) and statistics by assigning the values to the text (positive,
negative, or natural), identify the mood of the context (happy, sad, angry, etc.)
Artificial Intelligence and Application
4. Machine Translation
Machine translation is used to translate text or speech from one natural language to another natural language.
5 . Speech Recognition
Speech recognition is used for converting spoken words into text. It is used in applications, such as mobile, home automation, video recovery, dictating
to Microsoft Word, voice biometrics, voice user interface, and so on.
Artificial Intelligence and Application
7. Chatbot
Implementing the Chatbot is one of the important applications of NLP. It is used by many companies to provide the customer's chat services.
It converts a large set of text into more formal representations such as first-order logic structures that are easier for the computer programs to
manipulate notations of the natural language processing.
Artificial Intelligence and Application
✓ Image Processing
▪ Image processing involves manipulating and analyzing images to enhance their quality, extract features, or recognize patterns.
▪ Traditional image processing techniques rely on predefined rules and algorithms to perform specific tasks, such as edge detection, image
segmentation, or object recognition.
▪ However, these techniques often face limitations when dealing with complex and diverse visual data.
✓ Computer Vision
▪ Computer vision is one of the most important fields of artificial intelligence (AI) and computer science engineering that makes computer systems
capable of extracting meaningful information from visual data like videos and images.
▪ Further, it also helps to take appropriate actions and make recommendations based on the extracted information.
▪ Further, Artificial intelligence is the branch of computer science that primarily deals with creating a smart and intelligent system that can behave and
think like the human brain.
▪ So, we can say if artificial intelligence enables computer systems to think intelligently, computer vision makes them capable of seeing, analyzing, and
understanding.
Artificial Intelligence and Application
▪ Computer vision is a technique that extracts information from visual data, such as images and videos.
▪ Although computer vision works similarly to human eyes with brain work, this is probably one of the biggest open questions for IT professionals:
▪ does the human brain operate and solve visual object recognition?
Artificial Intelligence and Application
✓ robot
▪ A robot is a machine that looks like a human, and is capable of performing out of box actions and replicating certain human movements
automatically by means of commands given to it using programming.
▪ Examples: Drug Compounding Robot, Automotive Industry Robots, Order Picking Robots, Industrial Floor Scrubbers and Sage Automation Gantry
Robots, etc.
Components of Robot
Several components construct a robot, these components are as follows:
Artificial Intelligence and Application
▪ Actuators: Actuators are the devices that are responsible for moving and controlling a system or machine. It helps to achieve physical movements by
converting energy like electrical, hydraulic and air, etc. Actuators can create linear as well as rotary motion.
▪ Power Supply: It is an electrical device that supplies electrical power to an electrical load. The primary function of the power supply is to convert
electrical current to power the load.
▪ Electric Motors: These are the devices that convert electrical energy into mechanical energy and are required for the rotational motion of the
machines.
▪ Pneumatic Air Muscles: Air Muscles are soft pneumatic devices that are ideally best fitted for robotics. They can contract and extend and operate by
pressurized air filling a pneumatic bladder. Whenever air is introduced, it can contract up to 40%.
▪ Muscles wire: These are made up of nickel-titanium alloy called Nitinol and are very thin in shape. It can also extend and contract when a specific
amount of heat and electric current is supplied into it. Also, it can be formed and bent into different shapes when it is in its martensitic form. They can
contract by 5% when electrical current passes through them.
▪ Piezo Motors and Ultrasonic Motors: Piezoelectric motors or Piezo motors are the electrical devices that receive an electric signal and apply a
directional force to an opposing ceramic plate. It helps a robot to move in the desired direction. These are the best suited electrical motors for
industrial robots.
▪ Sensor: They provide the ability like see, hear, touch and movement like humans. Sensors are the devices or machines which help to detect the events
or changes in the environment and send data to the computer processor. These devices are usually equipped with other electronic devices. Similar to
human organs, the electrical sensor also plays a crucial role in Artificial Intelligence & robotics. AI algorithms control robots by sensing the
environment, and it provides real-time information to computer processors.
Artificial Intelligence and Application
Applications of Robotics
Robotics have different application areas. Some of the important applications domains of robotics are as follows:
▪ Robotics in defense sectors: The defense sector is undoubtedly the one of the main parts of any country. Each country wants their defense system
to be strong. Robots help to approach inaccessible and dangerous zone during war. DRDO has developed a robot named Daksh to destroy life-
threatening objects safely. They help soldiers to remain safe and deployed by the military in combat scenarios. Besides combat support, robots are
also deployed in anti-submarine operations, fire support, battle damage management, strike missions, and laying machines.
▪ Robotics in Medical sectors: Robots also help in various medical fields such as laparoscopy, neurosurgery, orthopedic surgery, disinfecting rooms,
dispensing medication, and various other medical domains.
▪ Robotics in Industrial Sector: Robots are used in various industrial manufacturing industries such as cutting, welding, assembly, disassembly, pick
and place for printed circuit boards, packaging & labelling, palletizing, product inspection & testing, colour coating, drilling, polishing and handling
the materials.
Moreover, Robotics technology increases productivity and profitability and reduces human efforts, resulting from lower physical strain and injury.
The industrial robot has some important advantages, which are as follows:
• Accuracy
• Flexibility
• Reduced labor charge
• Low noise operation
• Fewer production damages
• Increased productivity rate.
Artificial Intelligence and Application
▪ Robotics in Entertainment: Over the last decade, use of robots is continuously getting increased in entertainment areas. Robots are being
employed in entertainment sector, such as movies, animation, games and cartoons. Robots are very helpful where repetitive actions are required. A
camera-wielding robot helps shoot a movie scene as many times as needed without getting tired and frustrated. A big-name Disney has launched
hundreds of robots for the film industry.
▪ Robots in the mining industry: Robotics is very helpful for various mining applications such as robotic dozing, excavation and haulage, robotic
mapping & surveying, robotic drilling and explosive handling, etc. A mining robot can solely navigate flooded passages and use cameras and other
sensors to detect valuable minerals. Further, robots also help in excavation to detect gases and other materials and keep humans safe from harm
and injuries. The robot rock climbers are used for space exploration, and underwater drones are used for ocean exploration.
2. Robots
Thank you !