0% found this document useful (0 votes)
9 views13 pages

Notes Unit 1

Uploaded by

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

Notes Unit 1

Uploaded by

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

Unit 1 Notes

INTRODUCTION – Learning, Types of Learning, Well defined learning problems, Designing


a Learning System, History of ML, Introduction of Machine Learning Approaches – (Artificial
Neural Network, Clustering, Reinforcement Learning, Decision Tree Learning, Bayesian
networks, Support Vector Machine, Genetic Algorithm), Issues in Machine Learning and Data
Science Vs Machine Learning;

Learning: To acquire knowledge or skills through study, experience, or being taught.


Or
it refers to how a model improves its performance over time by analyzing data and identifying
patterns. The model uses these patterns to make predictions or decisions without being
explicitly programmed for every specific task.
The goal is to find a function or mapping from input data to output data based on examples, so
the system can generalize and make accurate predictions on new, unseen data.
Types of Learning in Machine Learning
Machine learning can be broadly classified into three main types:
1. Supervised Learning
Definition:
In supervised learning, the model is trained on a labeled dataset, which means that each input
data point has a corresponding correct output (label). The model learns by comparing its
predicted output with the actual output and adjusts to reduce errors.
Example:
• Image Classification: Given a dataset of images labeled as "cats" or "dogs," the model
learns to classify new images as either a cat or a dog.
Algorithm Examples:
• Linear Regression
• Support Vector Machines (SVM)
• Decision Trees
• Neural Networks
2. Unsupervised Learning
Definition:
In unsupervised learning, the model is trained on an unlabeled dataset. The task is to identify
patterns, clusters, or associations within the data without any explicit guidance on what the
output should be.
Example:
• Customer Segmentation: An e-commerce company might want to segment customers
into different groups based on their purchasing behavior. The algorithm identifies
groups with similar behavior, even though no labels are provided.
Algorithm Examples:
• K-means Clustering
• Principal Component Analysis (PCA)
• Hierarchical Clustering
3. Semi-Supervised Learning
Semi-supervised learning is a mix between supervised and unsupervised learning. It uses a
small amount of labeled data and a large amount of unlabeled data. The model improves by
learning from both.
• Example: A small set of labeled emails as spam or not, combined with a large set of
unlabeled emails, to improve the spam detection model.
4. Reinforcement Learning:
In reinforcement learning, an agent interacts with an environment and learns to take actions
that maximize cumulative rewards. Instead of being trained on labeled data, the agent learns
by trial and error, receiving rewards or penalties based on the actions taken.
Example:
• Game Playing: In a game like chess or Go, the algorithm learns to play by receiving
positive rewards for winning and negative rewards for losing, optimizing its strategy
over time.
Algorithm Examples:
• Q-Learning
• Deep Q Networks (DQN)

Well defined Learning


A well-defined or well posed learning problem in machine learning is one where the objective,
data, and performance measure are clearly specified. For a learning problem to be well-defined,
it should have the following components:
1. Task (T): The specific goal or task the model is supposed to perform.
2. Performance Measure (P): A metric or criterion used to evaluate how well the model
performs the task.
3. Experience (E): The data or past experience used by the model to learn or improve its
performance.
The key idea is that by gaining experience from the data, the system improves its ability
to perform the given task according to the performance measure.
Example of a Well-Defined Learning Problem:
Email Spam Classification:
• Task (T): Classify emails as either "spam" or "not spam."
• Performance Measure (P): Accuracy, precision, recall, or F1-score. For example, we
might measure how often the model correctly classifies an email as spam or not spam.
• Experience (E): A dataset of labeled emails where each email is marked as either "spam"
or "not spam."

History of ML:
1. 1950s: Alan Turing's ideas on machine intelligence and the development of the
Perceptron (1957) laid the foundation for early machine learning.
2. 1960s: Focus on neural networks and simple learning algorithms like the Perceptron.
3. 1970s: Neural networks decline due to their limitations; focus shifts to rule-based
systems and symbolic AI.
4. 1980s: Revival of neural networks with the development of the backpropagation
algorithm, enabling multi-layer networks to learn complex tasks.
5. 1990s: Rise of Support Vector Machines (SVM), Bayesian networks, and the shift to
data-driven learning from large datasets.
6. 2000s: Growth of ensemble methods (e.g., random forests) and the explosion of big
data, driving advancements in machine learning.
7. 2010s: Deep learning revolution with breakthroughs in image and speech recognition
using Convolutional Neural Networks (CNNs) and Recurrent Neural Networks
(RNNs).
8. 2012: AlexNet wins ImageNet competition, marking a major success for deep learning
in computer vision.
9. 2016: AlphaGo's victory over human Go champions highlights the power of
reinforcement learning and deep learning.
10. 2020s: Widespread use of machine learning, powered by advanced models like
Transformers (GPT-3, BERT), with a growing emphasis on AI ethics and explainability.

Artificial Neural Network (ANN):


An Artificial Neural Network (ANN) is a computational model inspired by the way biological
neural networks in the human brain work. It is designed to recognize patterns, learn from data,
and make decisions or predictions by mimicking the structure and functioning of neurons in a
brain. ANNs are the core technology behind deep learning and are widely used in applications
such as image recognition, speech processing, and more.
Key Components of an ANN:
1. Neurons (Nodes): Basic units of the network. Each neuron takes input, processes it, and
generates an output.
2. Layers:
o Input Layer: Receives the initial data and passes it to the hidden layer.
o Hidden Layers: Perform computations on the input data. There can be multiple
hidden layers in deep neural networks.
o Output Layer: Produces the final prediction or output of the network.
3. Weights and Biases: Weights control the strength of the connection between neurons.
Bias helps adjust the output along with weights.
4. Activation Function: Introduces non-linearity to the model, allowing the network to
learn complex patterns. Common activation functions include sigmoid, and ReLU.
Clustering:
Clustering is a type of unsupervised machine learning technique used to group a set of objects
or data points into clusters based on their similarities or patterns. The goal is to ensure that
objects within the same cluster are more similar to each other than to those in other clusters.
Example:
Customer Segmentation:
In a retail business, a company may want to understand its customer base better to tailor
marketing strategies. By analyzing customer data (such as age, income, purchasing behavior,
and shopping frequency), clustering can be employed to group customers into distinct
segments.
It consists of the following steps
1. Data Collection: Gather customer data, which may include variables like age, income,
purchase history, and more.
2. Clustering Algorithm: Use a clustering algorithm like K-means, hierarchical clustering,
or DBSCAN to identify clusters.
3. Result: After applying the algorithm, the company may find several clusters, such as:
o Cluster 1: Young, high-income customers who frequently shop online.
o Cluster 2: Middle-aged customers who prefer in-store shopping.
o Cluster 3: Older customers with low purchase frequency.

Data points before clustering


Data points after clustering
Reinforcement Learning:
In reinforcement learning, an agent interacts with an environment and learns to take actions
that maximize cumulative rewards. Instead of being trained on labeled data, the agent learns
by trial and error, receiving rewards or penalties based on the actions taken.
Example:
• Game Playing: In a game like chess or Go, the algorithm learns to play by receiving
positive rewards for winning and negative rewards for losing, optimizing its strategy
over time.
Algorithm Examples:
• Q-Learning
• Deep Q Networks (DQN)

Decision Tree Learning:


Decision Tree Learning is a supervised machine learning technique used for classification. It
involves creating a model that predicts the value of a target variable based on several input
features. The model is represented as a tree structure, where each internal node represents a
decision based on an attribute, each branch represents the outcome of that decision, and each
leaf node represents a final prediction or class label.
Support Vector Machine (SVM):
Support Vector Machine (SVM) is a supervised machine learning algorithm primarily used for
classification tasks, but it can also be adapted for regression. SVM aims to find the optimal
hyperplane that separates data points of different classes in a high-dimensional space. The
optimal hyperplane is the one that maximizes the margin, which is the distance between the
hyperplane and the nearest data points from each class, known as support vectors.

Genetic Algorithm:
Example of a Genetic Algorithm:
Scenario: Imagine you want to find the best route for a delivery truck that needs to visit several
cities.
1. Step 1 - Population: Start with random routes, like:
o Route 1: City A → City B → City C → City D
o Route 2: City C → City A → City D → City B
2. Step 2 - Fitness Function: Calculate the total distance for each route. Shorter distances
score higher. For example:
o Route 1: 100 miles
o Route 2: 80 miles (better route)
3. Step 3 - Selection: Select the best routes based on distance. In this case, Route 2 is
chosen more often.
4. Step 4 - Crossover: Mix routes to create new ones. If you combine parts of Route 1 and
Route 2, you might get:
o New Route: City C → City B → City A → City D
5. Step 5 - Mutation: Randomly change a route by swapping two cities. For example:
o From: City C → City B → City A → City D
o To: City C → City A → City B → City D
6. Step 6 - Repeat: Keep repeating the process of evaluating, selecting, crossing over, and
mutating until you find the shortest route.

Issues in Machine Learning


1. Data Quality and Quantity
• Insufficient Data: Many machine learning models require large amounts of data to learn
effectively. A lack of data can lead to overfitting, where the model performs well on
training data but poorly on unseen data.
• Noisy Data: Data can be noisy or contain errors, which can negatively affect the model's
performance.
• Imbalanced Data: When the dataset has an unequal distribution of classes (e.g., many
more examples of one class than another), it can lead to biased models that perform
poorly on the minority class.
• Biased Data
2. Model Overfitting and Underfitting
• Overfitting: A model that learns the training data too well may capture noise instead of
the underlying patterns, resulting in poor generalization to new data.
• Underfitting: A model that is too simple may fail to capture important relationships in
the data, leading to poor performance on both training and test datasets.
3. Feature Engineering
• Feature Selection: Identifying the most relevant features to use for model training can
be challenging and time-consuming.
• Dimensionality Reduction: High-dimensional data can lead to the "curse of
dimensionality," where the model struggles to learn effectively due to the sparsity of
data in high dimensions.

Bayesian Belief Networks (BBNs)


A Bayesian Belief Network (BBN), also called a Bayesian Network or Bayes Network, is a
probabilistic graphical model that represents a set of variables and their conditional
dependencies using a directed acyclic graph (DAG). It provides a way to model uncertainty by
describing the joint probability distribution among the variables, and it allows reasoning about
the likelihood of various events based on the known information.
Key Components:
1. Nodes: Represent random variables (these could be observed variables, latent variables,
or hypotheses).
2. Edges (Arrows): Represent conditional dependencies between the variables. An edge
from node A to node B means that B is conditionally dependent on A.
3. Conditional Probability Tables (CPTs): Each node has a conditional probability
distribution that quantifies the effect of its parent nodes (if any) on that variable.
Example of a Bayesian Belief Network:
Consider a simple Bayesian network that models the relationship between three variables:
1. Weather (W): Can be "Sunny", "Rainy", or "Cloudy".
2. Sprinkler (S): Whether a sprinkler was turned on (Yes/No).
3. Wet Grass (G): Whether the grass is wet (Yes/No).
Structure:
• Weather influences both the Sprinkler and whether the Grass is Wet.
• Sprinkler also influences whether the Grass is Wet.
Network structure would look like this:
Data Science Vs Machine Learning:

Traditional Programming Vs Machine Learning


Traditional Programming
Definition: In traditional programming, developers write explicit instructions (code) that tell
the computer how to perform a specific task. The program follows these rules to produce the
desired output.
Example: A Simple Calculator
• Task: Perform basic arithmetic operations (addition, subtraction, multiplication,
division).
• Implementation: A programmer writes a function that takes two numbers and an
operation as input and returns the result. The logic is predefined.
Machine Learning
Definition: In machine learning, the program learns from data instead of following explicit
instructions. The developer provides a dataset, and the algorithm identifies patterns within the
data to make predictions or decisions.
Example: Email Spam Detection
• Task: Classify emails as "spam" or "not spam."
• Implementation: A machine learning model is trained on a dataset of labeled emails
(spam and not spam). The model learns features that distinguish spam from non-spam
emails.

Criteria Supervised ML Unsupervised ML Reinforcement ML


Definition Machine learns by Machine is trained using Agent interacts with the environment
using labelled data unlabelled data without by performing action. Learns by
any guidance errors and rewards.

Types of Labelled Data Unlabelled Data No-Predefined Data


Data

Types of Regression and Association and Rewards and error based


Problems Classification Clustering

Supervision External No Supervision No Supervision


Supervision

Algorithms Linear regression, K-Means Clustering, Monte-Carlo, Q-learning, SARSA


Logistic PCA, Neural Networks
Regression, Naïve
Bayes, Decision
Tree, KNN

Aim Calculate Discover Underlying Learn a series of action


Outcomes patterns

Approach Maps labelled Understand patterns & Follow the trial and error method
inputs to the known discover output
outputs

Application Risk Evaluation, Recommendation Self Driving Cars, Gaming, Health


Forecast Sales System, Anomaly Care
Detection

Difference between Supervised , Unsupervised and Reinforcement ML

Regression Vs Classification:
Independent Variable vs. Dependent Variable:
Independent Variable: The independent variable is the variable that is manipulated or controlled
in an experiment to test its effects on the dependent variable. It is often considered the "cause"
in a cause-and-effect relationship.
Dependent Variable: The dependent variable is the variable that is measured or observed in
response to changes in the independent variable. It is considered the "effect" in a cause-and-
effect relationship.
The amount of sunlight each plant receives per day (In hours) - Independent
The growth of the plants, measured in height (in cm)- Dependent

What is AI:
• The intelligence of machines or software.
• Machine imitates like human beings.
• Ability of machines to think and learn.

You might also like