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

Unit1 ML

The document provides an overview of machine learning, its definitions, types, and applications, emphasizing its role as a subset of artificial intelligence that enables computers to learn from data. It discusses various learning models, including geometric, logical, probabilistic models, and the processes involved in designing a learning system. Additionally, it outlines the machine learning lifecycle, key differences between machine learning and traditional programming, and practical applications across various fields.

Uploaded by

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

Unit1 ML

The document provides an overview of machine learning, its definitions, types, and applications, emphasizing its role as a subset of artificial intelligence that enables computers to learn from data. It discusses various learning models, including geometric, logical, probabilistic models, and the processes involved in designing a learning system. Additionally, it outlines the machine learning lifecycle, key differences between machine learning and traditional programming, and practical applications across various fields.

Uploaded by

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

MACHINE LEARNING

UNIT-I: Introduction to Machine Learning


Introduction, Components of Learning, Learning
Models, Geometric Models, Probabilistic Models, Logic
Models, Grouping and Grading, Designing a Learning
System, Types of Learning, Supervised, Unsupervised,
Reinforcement, Perspectives and Issues, Version
Spaces, PAC Learning, VC Dimension.

Introduction:
Machine learning is a subfield of artificial intelligence, which is broadly defined as the
capability of a machine to imitate intelligent human behaviour. Artificial intelligence systems
are used to perform complex tasks in a way that is similar to how humans solve problems.
The term machine learning was first introduced by Arthur Samuel in 1959. “Machine
Learning is the field of study that gives computers the capability to learn without being
explicitly programmed”. Machine learning (ML) is a field devoted to understanding and
building methods that let machines "learn" – that is, methods that leverage data to improve
computer performance on some set of tasks. Machine can learn itself from past data and
automatically improve. Machine learning is used to make decisions based on data. By
modelling the algorithms on the bases of historical data, Algorithms find the patterns and
relationships that are difficult for humans to detect. Machine learning (ML) is the process of
using mathematical models of data to help a computer learn without direct instruction. It’s
considered a subset of artificial intelligence (AI). Machine learning uses algorithms to
identify patterns within data, and those patterns are then used to create a data model that
can make predictions. With increased data and experience, the results of machine learning
are more accurate. Think, for example, of a supermarket chain that is selling thousands of
goods to millions of customers. The details of each transaction are stored: date, customer
id, goods bought and their amount, total money spent, and so forth. This typically amounts
to a lot of data every day. What the supermarket chain wants is to be able to predict which
customer is likely to buy which product, to maximize sales and profit. Similarly, each
customer wants to find the set of products best matching his/her needs.
The regular problems will have a fixed input and output. For some tasks, however, we do
not have an algorithm. Predicting customer behaviour is one; another is to tell spam emails
from legitimate ones. Machine learning also helps us find solutions to many problems in
vision, speech recognition, and robotics. With the help of sample historical data, which is
known as training data, machine learning algorithms build a mathematical model that helps
in making predictions or decisions without being explicitly programmed. Machine learning
brings computer science and statistics together for creating predictive models. Note:
Machine learning is primarily concerned with the accuracy and effectiveness of the
computer system

Traditional Programming Vs Machine learning:

What is Machine Learning?


Machine learning is a branch of artificial intelligence that enables algorithms to uncover
hidden patterns within datasets. It allows them to predict new, similar data without explicit
programming for each task. Machine learning finds applications in diverse fields such as
image and speech recognition, natural language processing, recommendation systems,
fraud detection, portfolio optimization, and automating tasks.
Machine learning’s impact extends to autonomous vehicles, drones, and robots, enhancing
their adaptability in dynamic environments. This approach marks a breakthrough where
machines learn from data examples to generate accurate outcomes, closely intertwined
with data mining and data science.
Need for Machine Learning:
Machine learning is important because it allows computers to learn from data and improve
their performance on specific tasks without being explicitly programmed. This ability to
learn from data and adapt to new situations makes machine learning particularly useful for
tasks that involve large amounts of data, complex decision-making, and dynamic
environments.
Here are some specific areas where machine learning is being used:
 Predictive modeling: Machine learning can be used to build predictive models that
can help businesses make better decisions. For example, machine learning can be
used to predict which customers are most likely to buy a particular product, or which
patients are most likely to develop a certain disease.
 Natural language processing: Machine learning is used to build systems that can
understand and interpret human language. This is important for applications such as
voice recognition, chatbots, and language translation.
 Computer vision: Machine learning is used to build systems that can recognize and
interpret images and videos. This is important for applications such as self-driving
cars, surveillance systems, and medical imaging.
 Fraud detection: Machine learning can be used to detect fraudulent behavior in
financial transactions, online advertising, and other areas.
 Recommendation systems: Machine learning can be used to build recommendation
systems that suggest products, services, or content to users based on their past
behavior and preferences.
Overall, machine learning has become an essential tool for many businesses and industries,
as it enables them to make better use of data, improve their decision-making processes, and
deliver more personalized experiences to their customers.
Difference between Machine Learning, Traditional Programming and Artificial
Intelligence
Traditional
Machine Learning Programming Artificial Intelligence

A subset of AI focusing on Writing rule-based, Technology that enables


creating algorithms that deterministic code based machines to perform tasks
learn from data and make on specific problem that typically require human
predictions. statements. intelligence.

Uses a mix of data-driven


Rule-based and
Data-driven, learns from techniques and predefined
deterministic, relies on
historical data to predict rules, incorporating ML, deep
explicit instructions from
future outcomes. learning, and traditional
developers.
programming.

Adapts and evolves to


Capable of finding Lacks self-learning
perform complex tasks with
patterns and insights in capabilities; output is
high accuracy, often
large datasets, learning directly tied to input and
exceeding human capabilities
and improving over time. predefined rules.
in specific domains.

Used in predictive Used to build applications


Broad applications including
analytics, autonomous with specific
natural language processing,
vehicles, chatbots, and functionalities like
computer vision, robotics,
other AI-based software tools and
and more.
applications. systems.

Combines the strengths of


Dependent on the quality Dependent on the
both ML and traditional
and diversity of data. Can intelligence and foresight
programming to tackle
perform poorly if data is of developers. Limited to
complex, multi-faceted
not representative. known scenarios.
problems.

Applications of Machine Learning:

1. Image recognition
2. Product recommendations
3. Speech Recognition
4. Natural language processing
5. Online fraud detection
6. Email filtering
7. Medical diagnosis
8. Stock market trading and many more.
Machine learning life cycle or Process: to implement/ to understand the working of
machine learning is see the stages in the approach:
The steps involved are:
• Gathering the data
• Preparing the data
• Choosing a model
• Train the model
• Evaluate the model
• Parameter tuning
• Make predictions

One can understand the whole process based on the diagrams given here:

Learning Models:
Machine Learning is all about using the right features to build the right models that achieve
the right tasks.
• Features: the workhorses of Machine Learning.
• Models: the output of Machine Learning.
• Tasks: the problems that can be solved with Machine Learning.
Models are the central concept in machine learning as they are what one learns from data in
order to solve a given task.
Models are classified into the following:
1. Geometric Models
2. Logical models
3. Probabilistic models
4. Grouping and Grading

Geometric Models: In Geometric models, features could be described as points in two


dimensions (x- and y-axis) or a three-dimensional space (x, y, and z). Even when features are
not intrinsically geometric, they could be modelled in a geometric manner (for example,
temperature as a function of time can be modelled in two axes). In geometric models, there
are two ways we could impose similarity. A geometric model is a mathematical
representation of an object or system that uses geometry to describe its properties and
relationships. In machine learning, geometric models can be used to represent data in a way
that allows us to analyse its properties and relationships.
• It uses geometric elements like lines, plane to segment or classify the instance space.
These are called as linear models. Otherwise, we use geometric notion of distance to
represent similarity. In this case, if two points are close together, they have similar values
for features and thus can be classed as similar. We call such models as Distance based
models. The distance models use either Euclidean/Manhattan models.
• Distance models use centroid and medoids. Here medoids are calculated where
mean/centroid can’t be calculated.
• Distance based models use KNN algorithm. The nearest neighbour algorithm works by
finding the closest data point to a given query point in a geometric space.
• Geometric models can also be used in clustering tasks, where the goal is to group similar
data points together. • Geometric models have a wide range of applications in machine
learning, including image and speech recognition, natural language processing, and
recommendation systems.
• One of the advantages of geometric models is their ability to handle complex data
structures and relationships. For example, graph neural networks (GNNs) can be used to
analyse data represented as a graph, such as social networks or molecular structures.
• Either linear classifier or large marginal classifier can be used to build the model

Logical Models: Use a logical expression to divide the instance space into segments and
hence construct grouping models. Here the instance space is a collection of all possible
instances to build the right model. A logical expression always results in Boolean value TRUE
or FALSE as outcome. There are 2 types of logical models:
Tree based and Rule based.
i) Tree Models: Here the tree structure is built to make the necessary model.
The tree consists of ellipses for features and rectangles for leaves. The leaves
consist of a CLASS/ VALUE/ PROBOBILITIES. If the value is a class, then the feature tree is a
Decision Tree.
The tree models use divide and conquer approach for making a tree. The popularly used
tree-based Machine Learning algorithms are- Decision Tree, Random Forest and XGBoost.
Ex-1: Here is an illustration of how the Decision Tree algorithm works in segmenting a set of
data points into 2 classes: “sold out” and “not sold out”. First, the algorithm will divide the
data into two parts using a horizontal or vertical line. In this case, the first step is done by
splitting the x-axis using a vertical line separating the price above and below $600. Next, the
algorithm splits the y-axis into the left and right sides. We can see that for the price above
$600, the products will be sold if the quality is above 60 and not sold if it is below 60. If the
price is below $600, the algorithm needs further segmentation.
Ex-1 Ex-2

ii) Ex-2
Rule Models: Here it consists of IF-THEN rules. The ‘if-parts’ define a segment and the
‘then-part’ defines the behaviour of the model. This is “Logical” because models of this kind
can easily be translated into rules that humans can understand, such as ., if lottery = 1 then
class = Y = spam. in case of Email SPAM or HAM. It uses separate and conquer technique.
Ex:
if SAVINGS = MEDIUM then credit_risk = good
else
if (SAVINGS = HIGH) then
if (INCOME = LOW) THEN
credit_risk = bad
else
credit_risk = good
else if (ASSETS = LOW) then
credit_risk = bad
else
credit_risk = good

Probabilistic Models:
Probabilistic models see features and target variables as random variables. The process of
modelling represents and manipulates the level of uncertainty with respect to these
variables. Probabilistic models use the idea of probability to classify new instances.
There are two types of probabilistic models:
Predictive and
Generative.
• Predictive analytics refers to the process of using statistical techniques, data mining, and
machine learning algorithms to analyse historical data and make predictions about future
events or trends. By uncovering patterns and relationships within datasets, predictive
analytics enables businesses and organizations to make data-driven decisions, anticipate
customer behaviour, optimize operations, and identify potential risks.
• Generative models are designed to address various purposes ranging from image
synthesis, text generation to drug discovery.
• Predictive probability models use the idea of a conditional probability distribution P (Y |X)
from which Y can be predicted from X.
• Generative models estimate the joint distribution P (Y, X). Once we know the joint
distribution for the generative models, we can derive any conditional or marginal
distribution involving the same variables Probabilistic models use the idea of probability to
classify new entities Naïve Bayes is an example of a probabilistic classifier.

Grouping and Grading:


Grouping and grading in ML are often associated with Clustering and Classification, two
major machine learning tasks used for organizing data.

1. Grouping (Clustering)
 Definition: The process of dividing a dataset into meaningful clusters or groups
without predefined labels.
 Type: Unsupervised Learning
 Purpose: Identifies patterns and groups similar data points together based on
similarities.
 Example Use Cases:
o Customer segmentation in marketing.
o Anomaly detection in network security.
o Grouping news articles based on topics.
Popular Clustering Algorithms:
 K-Means Clustering – Divides data into K clusters.
 Hierarchical Clustering – Builds a tree-like hierarchy of clusters.
 DBSCAN – Identifies clusters of varying shapes and detects noise.

2. Grading (Classification)
 Definition: Assigning labels or categories to data based on training from pre-labeled
examples.
 Type: Supervised Learning
 Purpose: Helps in predicting categories (grades, labels, or classes) based on input
features.
 Example Use Cases:
o Email spam detection (Spam/Not Spam).
o Grading students based on their test scores (A, B, C, etc.).
o Diagnosing diseases based on symptoms (Healthy/Sick).
Popular Classification Algorithms:
 Logistic Regression – Best for binary classification (Yes/No).
 Decision Trees & Random Forests – Handle complex decision-making.
 Support Vector Machines (SVM) – Separates classes using hyperplanes.
 Neural Networks – Used for deep learning-based classification.

Key Differences:
Feature Grouping (Clustering) Grading (Classification)
Learning Type Unsupervised Supervised
Output Groups/clusters (No labels) Labeled categories
Use Case Customer segmentation Spam detection
Algorithms K-Means, DBSCAN Decision Trees, SVM

Designing a Learning System:

Here are the 10 steps to learn and design a learning system:

Step 1: Define the Learning Objectives


1. Identify the target audience and their needs.
2. Determine the knowledge or skills to be acquired.
3. Set specific, measurable, achievable, relevant, and time-bound (SMART) objectives.
Step 2: Conduct a Needs Assessment
1. Analyze the learners' current knowledge and skills.
2. Identify knowledge gaps and areas for improvement.
3. Determine the most effective learning strategies.
Step 3: Choose a Learning Theory or Model
1. Familiarize yourself with various learning theories (e.g., behaviorism, cognitivism,
constructivism).
2. Select a theory or model that aligns with your learning objectives and audience.
Step 4: Design the Learning System Architecture
1. Decide on the learning system's scope, structure, and components.
2. Determine the delivery methods (e.g., online, offline, blended).
3. Plan the user interface, user experience, and navigation.
Step 5: Develop the Learning Content
1. Create learning materials that align with the learning objectives.
2. Use a variety of content formats (e.g., text, images, videos, quizzes).
3. Ensure content is engaging, interactive, and relevant.
Step 6: Select the Learning Platform or Tools
1. Choose a learning management system (LMS) or platform.
2. Select tools for content creation, delivery, and assessment.
3. Ensure the tools integrate seamlessly with the LMS.
Step 7: Implement the Learning System
1. Configure the LMS to support your learning system design.
2. Upload and integrate the learning content.
3. Test the system to ensure smooth functionality.
Step 8: Test and Evaluate the Learning System
1. Conduct alpha and beta testing with a small group of learners.
2. Gather feedback and iterate on the design and content.
3. Evaluate the learning system's effectiveness using metrics.
Step 9: Launch and Promote the Learning System
1. Launch the learning system to the target audience.
2. Develop a marketing plan to promote the system.
3. Encourage user engagement and feedback.
Step 10: Maintain and Update the Learning System
1. Regularly review and update the learning content.
2. Monitor learner engagement and adjust the system as needed.
3. Continuously evaluate and improve the learning system.

ML Tools:
To implement the machine learning concepts user can deploy his own code or can take the
assistance of libraries. Python provides a better list of libraries. The Python libraries that are
used in Machine Learning are: Numpy, Scipy, Scikit-learn, TensorFlow, Keras, PyTorch,
Pandas, Matplotlib.

Types of Learning:
Machine learning offers a variety of techniques and models you can choose based on your
application, the size of data you're processing, and the type of problem you want to solve.
Here is the machine learning process given in the diagram.

1. Supervised Learning
2. Unsupervised Learning
3. Reinforced Learning
Supervised Learning:
Supervised learning is a machine learning approach that’s defined by its use of labeled
datasets. These datasets are designed to train or “supervise” algorithms into classifying data
or predicting outcomes accurately. Using labeled inputs and outputs, the model can
measure its accuracy and learn over time.
Supervised learning is the types of machine learning in which machines are trained using
well "labelled" training data, and on basis of that data, machines predict the output. The
labelled data means some input data is already tagged with the correct output. Suppose we
have a dataset of different types of shapes which includes square, rectangle, triangle, and
Polygon. Now the first step is that we need to train the model for each shape.
o If the given shape has four sides, and all the sides are equal, then it will be labelled as a
Square.
o If the given shape has three sides, then it will be labelled as a triangle.
o If the given shape has six equal sides, then it will be labelled as hexagon.
Now, after training, we test our model using the test set, and the task of the model is to
identify the shape.

Steps Involved in Supervised Learning:


1. Determine the type of training dataset required
2. Collect/Gather the labelled training data.
3. Split the training dataset into training dataset, test dataset, and validation dataset.
4. Determine the key input features of the training dataset so that the model can accurately
predict the output.
5. Determine the suitable algorithm for the model, such as Decision Tree / Support vector
machine, etc.
6. Execute the algorithm on the training dataset. Sometimes we need validation sets as the
control parameters, which are the subset of training datasets.
7. Evaluate the accuracy of the model by providing the test set. If the model predicts the
correct output, which means our model is accurate.

For example, your spam filter is a machine learning program that can learn to flag spam
after being given examples of spam emails that are flagged by users, and examples of
regular non-spam (also called “ham”) emails. The examples the system uses to learn are
called the training set. In this case, the task (T) is to flag spam for new emails, the experience
(E) is the training data, and the performance measure (P) needs to be defined. For example,
you can use the ratio of correctly classified emails as P. This particular performance measure
is called accuracy and it is often used in classification tasks as it is a supervised learning
approach. Examples: Linear Regression, Logistic Regression, KNN classification, Support
Vector Machine (SVM), Decision Trees, Random Forest, Naïve Bayes’ theorem.

Supervised learning is further divided into 2 types: Regression & Classification.


Classification: Supervised learning problem that involves predicting a class label
Regression: Supervised learning problem that involves predicting a numerical label

Classification:
Classification in machine learning categorizes data into predefined groups based on shared
characteristics. Machine learning models learn the characteristics of each group from the
input data and then generalize this information to new data points. You’d likely choose this
for tasks where your output falls into a category, meaning it’s a discrete outcome. For
example, you might determine the type of tumor from a medical scan, segment customers
based on purchasing behavior, categorize customer feedback, or classify email types.
What is classification used for?
The application of classification depends on the type of classification algorithm you use. You
can opt for different classification models, such as binary, multiclass, and multilabel.
Binary classification categorizes data into one of two groups. Examples of this might include
filtering spam emails (spam/not spam), detecting fraud (fraud/not fraud), or diagnosing a
disease (disease/no disease).
Multiclass classification groups data into several distinctive groups with no overlap. For
example, if you had an image classifier, you might group pictures of dogs into breeds such as
“dalmatian,” “collie,” and “poodle.” If you have overlap in your groups, this is a multilabel
classification. For example, if you classified videos, you could simultaneously label a movie
as “action” or “comedy” or label it as both genres.
Advantages and disadvantages of classification
To determine whether classification is the right machine learning method for your data, it’s
important to weigh the pros and cons to make an informed decision. Advantages and
disadvantages to consider as a starting point include:
Advantages
 Versatile input data: You can use classification with various input styles, including
text, images, audio, or video.
 Easily evaluated: You can evaluate the performance of your model with many
established indicators and toolkits, helping you make decisions to maximize
efficiency, speed, and quality.
 Can make discrete or continuous predictions: You can use classification to make
discrete predictions, such as “disease” or “no disease,” as well as continuous
predictions, such as “25 percent probability of disease” and “75 percent probability
of no disease.”
Disadvantages
 Risk of overfitting or underfitting: Without sufficient training data, your model may
“overfit” by aligning too closely with the training data and failing to generalize to
new data. Conversely, it could “underfit” by struggling to learn meaningful patterns
due to insufficient exposure.
 Requires high-level training data: Your training data set must be structured in an
appropriate format to learn the categories and attribute features to them. This
involves some pre-processing and data management.
Regression:
Regression in machine learning is a technique used to predict a continuous outcome value
using the value of input variables. The algorithm analyzes the input data to understand the
relationship between independent variables and the dependent variable. For example, to
predict a student's future exam score (a continuous variable), you might use study time,
sleep hours, and previous grade averages as input variables. Regression models establish a
consistent framework for making accurate predictions of the dependent variable by
identifying patterns and relationships in the data.
What is regression used for?
Similar to classification methods, the application of regression depends on the type of
regression used. Often, you will work with simple linear regression or multiple linear
regression.
Simple linear regression models how independent variables relate to a dependent variable
by finding a straight line that best fits the data. For example, you might predict housing
prices based on square footage, product sales based on marketing budget, or disease spread
based on vaccination rates.
With multiple linear regression, you add more independent variables to predict your
response variable value. For example, you might predict housing prices based on square
footage, zip code, and number of available houses.
Advantages and disadvantages of regression
Regression is a powerful tool when used under the right conditions but has limitations.
Considering the advantages and disadvantages can help you make an educated choice
between regression and other machine learning methods.
Advantages
 Handles continuous and categorical outputs: Linear regression allows you to handle
continuous outputs, while logistic regression works well with categorical outputs.
 Easily interpretable: Regression outputs offer insight into the magnitude of the
association between variables, allowing a clearer understanding of your model.
 Low computational requirement: Regression analysis is simpler and more efficient
to implement compared to other machine learning algorithms.
Disadvantages
 Relies on accurate data and assumptions: If you have incorrect data or assumptions,
regression models can make inaccurate predictions, leading to poor decision-making.
 Doesn’t imply causation: While regression results can show correlations between
variables, they do not necessarily imply that changes in certain variables cause
changes in another.
 Requires careful variable selection: Accurate predictions for the dependent variable
rely on selecting the right set of independent variables to effectively capture the
underlying relationships in the data.
Unsupervised Learning:
Unsupervised learning is a branch of Machine Learning that deals with unlabeled data.
Unlike supervised learning, where the data is labeled with a specific category or outcome,
unsupervised learning algorithms are tasked with finding patterns and relationships within
the data without any prior knowledge of the data’s meaning. Unsupervised machine
learning algorithms find hidden patterns and data without any human intervention, i.e., we
don’t give output to our model. The training model has only input parameter values and
discovers the groups or patterns on its own.

The image shows set of animals: elephants, camels, and cows that represents raw data that
the unsupervised learning algorithm will process.
 The “Interpretation” stage signifies that the algorithm doesn’t have predefined labels
or categories for the data. It needs to figure out how to group or organize the data
based on inherent patterns.
 Algorithm represents the core of unsupervised learning process using techniques
like clustering, dimensionality reduction, or anomaly detection to identify patterns
and structures in the data.
 Processing stage shows the algorithm working on the data.
The output shows the results of the unsupervised learning process. In this case, the
algorithm might have grouped the animals into clusters based on their species (elephants,
camels, cows).
How does unsupervised learning work?
Unsupervised learning works by analyzing unlabeled data to identify patterns and
relationships. The data is not labeled with any predefined categories or outcomes, so the
algorithm must find these patterns and relationships on its own. This can be a challenging
task, but it can also be very rewarding, as it can reveal insights into the data that would not
be apparent from a labeled dataset.
Data-set in Figure A is Mall data that contains information about its clients that subscribe to
them. Once subscribed they are provided a membership card and the mall has complete
information about the customer and his/her every purchase. Now using this data and
unsupervised learning techniques, the mall can easily group clients based on the parameters
we are feeding in.

The input to the unsupervised learning models is as follows:


 Unstructured data: May contain noisy(meaningless) data, missing values, or
unknown data
 Unlabeled data: Data only contains a value for input parameters, there is no
targeted value(output). It is easy to collect as compared to the labeled one in the
Supervised approach.
Unsupervised learning provides the following features:
• Clustering: Unsupervised learning problem that involves finding groups in data
• Density estimation: Unsupervised learning problem that involves summarizing the
distribution of data
• Visualization: Unsupervised learning problem that involves creating plots of data
• Projection: Unsupervised learning problem that involves creating lower dimensional
representations of data

Examples: K-means clustering, neural networks

Reinforcement Learning:
Reinforcement Learning revolves around the idea that an agent (the learner or decision-
maker) interacts with an environment to achieve a goal. The agent performs actions and
receives feedback to optimize its decision-making over time.
 Agent: The decision-maker that performs actions.
 Environment: The world or system in which the agent operates.
 State: The situation or condition the agent is currently in.
 Action: The possible moves or decisions the agent can make.
 Reward: The feedback or result from the environment based on the agent’s action.

How Reinforcement Learning Works?


The RL process involves an agent performing actions in an environment, receiving rewards
or penalties based on those actions, and adjusting its behavior accordingly. This loop helps
the agent improve its decision-making over time to maximize the cumulative reward.
Here’s a breakdown of RL components:
 Policy: A strategy that the agent uses to determine the next action based on the
current state.
 Reward Function: A function that provides feedback on the actions taken, guiding
the agent towards its goal.
 Value Function: Estimates the future cumulative rewards the agent will receive from
a given state.
 Model of the Environment: A representation of the environment that predicts future
states and rewards, aiding in planning.
Example: Navigating a Maze, Q-learning, temporal-difference learning, and deep
reinforcement learning.

The main elements of an RL system are:


1. The agent or the learner
2. The environment the agent interacts with
3. The policy that the agent follows to take actions
4. The reward signal that the agent observes upon taking actions
Robotics. Robots with pre-programmed behaviour are useful in structured environments,
such as the assembly line of an automobile manufacturing plant, where the task is repetitive
in nature. In the real world, where the response of the environment to the behaviour of the
robot is uncertain, pre-programming accurate actions is nearly impossible. In such scenarios,
RL provides an efficient way to build general-purpose robots.
Autonomous Driving. An autonomous driving system must perform multiple perception
and planning tasks in an uncertain environment. Some specific tasks where RL finds
application include vehicle path planning and motion prediction.
Benefits of Reinforced Learning:
1. Focuses on the problem as a whole: Conventional machine learning algorithms are
designed to excel at specific subtasks, without a notion of the big picture. RL, on the other
hand, doesn’t divide the problem into subproblems; it directly works to maximize the long-
term reward. It has an obvious
2. Doesn’t need a separate data collection step: In RL, training data is obtained via the
direct interaction of the agent with the environment. Training data is the learning agent’s
experience, not a separate collection of data that has to be fed to the algorithm. This
significantly reduces the burden on the supervisor in charge of the training process.
3. Works in dynamic, uncertain environments. RL algorithms are inherently adaptive and
built to respond to changes in the environment. In RL, time matters and the experience that
the agent collects is not independently and identically distributed (i.i.d.), unlike conventional
machine learning algorithms.
Issues in Machine Learning:
1. Introduction
Machine Learning (ML) faces several challenges concerning training data and algorithm
selection. These issues impact model performance, accuracy, and generalization. The key
questions addressed in this document include:
 What algorithms exist for learning target functions from training examples?
 How much training data is sufficient?
 How can prior knowledge aid in generalization?
 What strategies improve training data selection?
 How can function approximation be automated?
 How can models be improved dynamically?
2. Key Issues and Challenges
2.1 Inadequate Training Data
The success of ML algorithms heavily depends on the quantity and quality of training data.
Inadequate data leads to poor generalization, incorrect predictions, and inefficiencies.
Factors affecting data quality:
 Noisy Data: Leads to inaccurate predictions and misclassification.
 Incorrect Data: Results in faulty model outputs and decreased accuracy.
 Generalization Issues: Poorly generalized models perform poorly on new data.
2.2 Poor Quality of Data
High-quality data is crucial for effective model training. Issues like noisy, incomplete, or
inaccurate data significantly reduce model accuracy and prediction quality.
Impacts of poor data quality:
 Leads to biased model predictions.
 Causes incorrect decision-making in classification and regression tasks.
 Results in non-representative training sets, reducing prediction reliability.
To ensure robust generalization, training data should be representative of the real-world
scenarios the model is expected to handle.
2.3 Improper Model Selection
Selecting the right ML model depends on data type, features, and problem complexity. Poor
data quality and incorrect feature selection affect model performance and decision-making.
Effects of improper model selection:
 May lead to inefficient learning and prediction errors.
 Reduces interpretability and generalization.
 Affects computational efficiency and scalability.
2.4 Overfitting and Underfitting
Overfitting occurs when a model learns the noise in training data instead of general
patterns. Underfitting happens when a model is too simplistic to capture underlying data
structures.
Overfitting Issues:
 The model memorizes training data but performs poorly on new data.
 Occurs due to excessive complexity or insufficient training data.
 Can be mitigated using techniques like regularization, cross-validation, and dropout.
Underfitting Issues:
 Model fails to capture key relationships in data.
 Results in poor prediction accuracy.
 Can be improved by increasing model complexity, adding features, and using better
algorithms.
 2.5 Hypothesis in Machine Learning
 A hypothesis is an assumption made based on some evidence. It serves as an initial
point for investigation, translating research questions into predictions. A hypothesis
includes components such as variables, population, and relationships between
variables.
 Example: Consumption of sugary drinks every day leads to obesity is an example of a
simple hypothesis.
 Let us say a hypothesis h makes a prediction for an instance x such that:
 h(x) = 1 if h classifies x as a positive example.
 h(x) = 0 if h classifies x as a negative example.
 In our example, the hypothesis class H is the set of all possible rectangles or
hypotheses.
 A hypothesis h is consistent with a set of training examples D, if and only if h(x) =
c(x) for each example in D.
Example Citations

 Hypothesis 1 (h1) = (?, ?, No, ?, Many) → Consistent


 Hypothesis 2 (h2) = (?, ?, No, ?, ?) → Inconsistent
2.6 Strategies to Improve Model Performance
Several techniques can be used to address data and algorithm-related issues:
1. Increase Training Data: Collect more data to improve learning outcomes.
2. Regularization Techniques: Use L1/L2 regularization to prevent overfitting.
3. Hyperparameter Tuning: Optimize parameters for better model performance.
4. Feature Engineering: Select and transform features to enhance learning.
5. Ensemble Learning: Combine multiple models to improve accuracy.
6. Cross-Validation: Test model robustness using validation sets.
3. Generalization in Machine Learning
Generalization refers to a model’s ability to perform well on unseen data. A well-
generalized model correctly predicts new data points based on patterns learned during
training.
 Overfitting: Model memorizes data, failing to generalize.
 Underfitting: Model is too simple to capture real-world patterns.
 Balanced Model: Optimized to handle both training and unseen data effectively.
4. Conclusion
Addressing training data and algorithmic challenges is essential for building robust ML
models. Ensuring high-quality data, selecting appropriate models, and applying the right
optimization techniques can significantly enhance machine learning outcomes. Continuous
evaluation, feature engineering, and generalization techniques are key to mitigating
common ML challenges.

Version Space:
The Version Space (VS) is a subset of hypotheses from a given hypothesis space H that are
consistent with all the training examples. In other words, it contains only the hypotheses
that correctly classify all the training instances seen so far.

Steps of the LIST-THEN-ELIMINATE Algorithm


This algorithm systematically reduces the version space by eliminating hypotheses that
contradict training data.
1. Initialize Version Space (VS)
o Start with all possible hypotheses H (the complete hypothesis space).
2. Process each training example (x, c(x))
o If a hypothesis h does not match the classification c(x) (i.e., h(x) ≠ c(x)),
remove it from VS.
o Keep only those hypotheses that classify x correctly.
3. Final Hypothesis Set
o After processing all training examples, the remaining hypotheses in VS are
the ones that generalize the concept correctly.
Example:
We are given two features:
 F1: {A, B}
 F2: {X, Y}
Step 1: Define the Instance Space
There are 4 possible training examples:
(A,X),(A,Y),(B,X),(B,Y)(A, X), (A, Y), (B, X), (B, Y)(A,X),(A,Y),(B,X),(B,Y)
Step 2: Define the Hypothesis Space
A hypothesis can be:
 Fully specific: (A,X)(A, X)(A,X) → Only classifies (A, X) as positive.
 Partially general: (A,?)(A, ?)(A,?) → Accepts any value of F2 when F1 = A.
 Completely general: (?,?)(?, ?)(?,?) → Accepts all instances.
The total hypothesis space consists of 16 hypotheses. However, only 10 are semantically
distinct:
(A,X),(A,Y),(A,?),(B,X),(B,Y),(B,?),(?,X),(?,Y),(?,?),(0,0)(A, X), (A, Y), (A, ?), (B, X), (B, Y), (B, ?),
(?, X), (?, Y), (?, ?), (0, 0)(A,X),(A,Y),(A,?),(B,X),(B,Y),(B,?),(?,X),(?,Y),(?,?),(0,0)
Step 3: Initialize the Version Space (VS)
Initially, VS contains all 10 hypotheses.
Step 4: Process Training Examples
We process two training instances:
1. (A, X) → YES
o Remove hypotheses that do not accept (A, X).
o Keep: (A,X),(A,?),(?,X),(?,?)(A, X), (A, ?), (?, X), (?, ?)(A,X),(A,?),(?,X),(?,?)
o Remove: (A,Y),(B,X),(B,Y),(B,?),(?,Y),(0,0)(A, Y), (B, X), (B, Y), (B, ?), (?, Y), (0, 0)
(A,Y),(B,X),(B,Y),(B,?),(?,Y),(0,0)
Updated VS:
{(A,X),(A,?),(?,X),(?,?)}\{(A, X), (A, ?), (?, X), (?, ?)\}{(A,X),(A,?),(?,X),(?,?)}
2. (A, Y) → YES
o Remove hypotheses that do not accept (A, Y).
o Keep: (A,Y),(A,?),(?,Y),(?,?)(A, Y), (A, ?), (?, Y), (?, ?)(A,Y),(A,?),(?,Y),(?,?)
o Remove: (A,X),(?,X)(A, X), (?, X)(A,X),(?,X)
Final VS:
{(A,?),(?,?)}\{(A, ?), (?, ?)\}{(A,?),(?,?)}
Step 5: Interpret the Final Hypothesis
 (A, ?): Means the target is YES for all values of F2 when F1 = A.
 (?, ?): Is the most general hypothesis, meaning all values of F1 and F2 may result in
YES.
Since (A, ?) is more specific than (?, ?), it is the best learned concept based on the given
training examples.

PAC Learning:
PAC Learning is a theoretical framework used in computational learning theory to
mathematically analyze learning algorithms. It helps answer key questions such as:
 What concepts can be learned efficiently?
 How many training samples are needed for a good hypothesis?
 How accurate and confident can we be in the learned hypothesis?

Key Ideas in PAC Learning


1. Goal: The learning algorithm selects a hypothesis hhh from a hypothesis class HHH
that is probably (with high probability) approximately correct (low generalization
error).
2. High probability: The hypothesis should be correct at least 1−δ1 - \delta1−δ of the
time.
3. Low error: The hypothesis should have an error rate less than ε\varepsilonε.
4. Efficient learnability: A concept class CCC is PAC-learnable if there exists a learning
algorithm AAA that outputs a hypothesis hhh with an error rate ≤ ε\varepsilonε and
confidence ≥ 1−δ1 - \delta1−δ, using a number of samples NNN that is polynomial in
1/ε1/\varepsilon1/ε and 1/δ1/\delta1/δ.

PAC Learning Framework


Main Components
Symbol Meaning
X Input space (set of all possible inputs)
C Concept class (set of target concepts)
H Hypothesis class (possible functions the algorithm can learn)
D Data distribution (samples are drawn from this)
S Training sample (subset of data points)
hS Hypothesis selected from HHH based on SSS
ε Accuracy parameter (acceptable error rate)
δ Confidence parameter (1 - probability of failure)
PAC Learnability Definition
A concept class CCC is PAC-learnable if there exists an algorithm AAA such that for every
concept c∈Cc \in Cc∈C and every probability distribution DDD over XXX, the algorithm finds
a hypothesis h∈Hh \in Hh∈H such that:
PD[h(x)≠c(x)]≤εP_{D} [ h(x) \neq c(x) ] \leq \varepsilonPD[h(x)=c(x)]≤ε
with probability at least 1−δ1 - \delta1−δ.
This means:
 The probability of choosing a "bad" hypothesis is at most δ\deltaδ.
 The probability of choosing a "good" hypothesis (low error ≤ ε\varepsilonε) is at least
1−δ1 - \delta1−δ.

Intuition Behind PAC Learning


1. "Probably" → With high probability 1−δ1 - \delta1−δ, the hypothesis hhh is good.
2. "Approximately Correct" → The hypothesis hhh has an error of at most ε\
varepsilonε.
3. PAC Learnability Condition:
o The number of required training examples N should be polynomial in 1/ε1/\
varepsilon1/ε and 1/δ1/\delta1/δ.
o The learning algorithm should run in polynomial time.

Example of PAC Learning


Imagine we are training a classifier to recognize cats and dogs. The features are:
 Fur type (short/long)
 Ear shape (pointy/rounded)
The learning algorithm will:
1. Take a set of labeled examples (training data).
2. Choose a hypothesis hhh from the hypothesis space HHH.
3. Ensure that hhh has an error ≤ ε\varepsilonε with probability ≥ 1−δ1 - \delta1−δ.
If the classifier is PAC-learnable, it means:
 With enough samples, the classifier will predict cats vs. dogs correctly most of the
time.
 The error rate (misclassifications) will be at most ε\varepsilonε.
 The model will generalize well to unseen data.

VC Dimension (Vapnik-Chervonenkis Dimension):


The VC Dimension is a fundamental concept in statistical learning theory that measures the
capacity (complexity) of a hypothesis class. It helps answer questions like:
 How expressive is a model? (Can it learn complex patterns?)
 How does model complexity affect generalization? (Will it perform well on unseen
data?)
 How do we avoid overfitting? (Choosing the right model capacity)

Key Definitions
1. Hypothesis Class (H)
o The set of all functions that a learning algorithm can choose from.
2. Shattering
o A hypothesis class H shatters a set of points if, for every possible labeling
(classification) of those points, there is a hypothesis h∈Hh \in Hh∈H that
correctly separates them.
3. VC Dimension (VC(H))
o The largest number of points that can be shattered by HHH.
o If there exists a set of nnn points that can be shattered by the classifier, but
no set of n+1n+1n+1 points can be shattered, then VC(H) = n.

Why is VC Dimension Important?


1. Generalization Analysis
o Models with high VC dimensions may overfit, capturing noise rather than
patterns.
o Models with low VC dimensions may underfit, failing to learn patterns in
data.
o The ideal VC dimension balances both and leads to good generalization.
2. Model Selection
o Helps in choosing models that are neither too simple nor too complex.
3. Error Bounds
o VC dimension provides a theoretical upper bound on the generalization
error.
4. Avoiding Overfitting
o If a model can shatter too many points, it has high complexity and risks
overfitting.

Examples

1️.Constant Classifier (Always "YES" or "NO")


 Example: A model that always predicts "YES" (e.g., "It will rain tomorrow!").
 No matter how many data points, it can classify them only one way.
 VC Dimension = 1 (Very simple, cannot learn much).

2️.Threshold Classifier (1D Line)


 Example: "Pass if marks > 50, else Fail."
 This classifier can separate one point, but struggles with two labeled differently.
 VC Dimension = 1.

3️.Interval Classifier (1D Range)


 Example: "Pass if marks are between 40 and 80."
 Can handle two points easily.
 Can also separate three points in some cases.
 But four points? Not always possible!
 VC Dimension = 2.

4️.Linear Classifier (2D Line)


 Example: A straight line dividing two types of points (e.g., cats vs. dogs based on
weight and height).
 Can always separate three points if not in a straight line.
 But four points in an "XOR" pattern cannot be separated.
 VC Dimension = 3.

You might also like