ML_Unit-1
ML_Unit-1
· Medical Diagnosis: Machine intelligence can be used to analyze patient data, medical images,
and reports to assist doctors in diagnosing diseases like cancer, diabetes, or heart conditions.
· Drug Discovery: Machine learning algorithms are used to predict how different chemical
compounds will interact with the human body, speeding up drug discovery.
Finance:
· Fraud Detection: Machine learning models analyze transaction patterns and detect unusual
activities that could signal fraud.
· Algorithmic Trading: ML algorithms predict market trends and make trading decisions in real-
time.
Autonomous Vehicles:
· Self-driving cars use machine intelligence to process data from sensors, cameras, and radar to
make real-time driving decisions.
· Virtual assistants like Siri and Alexa use machine intelligence to understand and respond to
voice commands.
· Machine translation systems like Google Translate are built using ML models to translate
languages.
Fraud Detection
· Application: ML algorithms help in detecting patterns and anomalies in financial transactions to identify
fraudulent activities.
· Examples:
· Detecting credit card fraud by analyzing transaction behavior.
· Identifying insurance fraud based on claims data.
· Spotting suspicious activities in banking systems to prevent money laundering.
· The process of feeding data to a machine learning model and allowing it to learn patterns and
relationships in the data.
Testing:
· After training, the model is tested on unseen data to evaluate its performance and accuracy.
Feature:
· An individual measurable property or characteristic of the data that is used as input to the ML
model (e.g., height, weight in a dataset about people).
Target:
· The variable that the model is trying to predict (e.g., in a housing price prediction model, the
target would be the price).
Data:
· The raw information that the machine learning model learns from. It consists of features (inputs)
and labels (outputs).
Model:
· The hypothesis that the learning algorithm uses to make predictions. It could be a simple linear
regression model or a complex neural network.
Loss Function:
· A function that measures how far off the model's predictions are from the actual values. The goal
of learning is to minimize this loss function.
Optimization Algorithm:
· The method used to update the model’s parameters to reduce the loss. Gradient Descent is a
popular optimization algorithm in ML.
Evaluation Metrics:
· These metrics help measure how well the model is performing. Common metrics include
accuracy, precision, recall, and F1-score for classification problems.
b. Unsupervised Learning:
· Definition: In unsupervised learning, the model is trained on an unlabeled dataset. The goal is to
find hidden patterns or intrinsic structures in the data.
· Examples:
· Clustering: Grouping similar data points together (e.g., segmenting customers into different
groups based on purchasing behavior).
· Dimensionality Reduction: Reducing the number of features in a dataset while preserving its
structure.
c. Reinforcement Learning:
· Definition: Reinforcement learning is a learning approach where an agent learns by interacting
with its environment. It receives feedback in the form of rewards or penalties based on its
actions.
· Example: Training a robotic arm to grasp an object by receiving feedback (rewards) for
successful attempts and penalties for failures.
6. Inductive Learning
· Definition: Inductive learning involves learning general rules from specific examples. The
system is given data and it tries to derive a general rule that can be applied to new, unseen data.
· Example: A model learning the general rule that "all birds can fly" based on examples of various
birds, but it may incorrectly apply this to flightless birds like penguins.
· Use in ML: Inductive learning forms the basis of many machine learning algorithms such as
decision trees, support vector machines, and neural networks.
7. Deductive Learning
· Definition: Deductive learning is the process of applying existing general rules to specific cases
to draw conclusions.
· Example: If you know the general rule "all mammals have lungs," you can deduce that a whale
(a specific mammal) must have lungs.
· Use in ML: Deductive learning is less common in machine learning but is used in rule-based
systems where knowledge is encoded in a series of rules.
A rapidly developing field of technology, machine learning allows computers to automatically learn from
previous data. For building mathematical models and making predictions based on historical data or information,
machine learning employs a variety of algorithms. It is currently being used for a variety of tasks, including
speech recognition, email filtering, auto-tagging on Facebook, a recommender system, and image recognition.
A subset of artificial intelligence known as machine learning focuses primarily on the creation of algorithms that
enable a computer to independently learn from data and previous experiences. Arthur Samuel first used the term
"machine learning" in 1959. It could be summarized as follows:
Without being explicitly programmed, machine learning enables a machine to automatically learn from data,
improve performance from experiences, and predict things.
Machine learning algorithms create a mathematical model that, without being explicitly programmed, aids in
making predictions or decisions with the assistance of sample historical data, or training data. For the purpose of
developing predictive models, machine learning brings together statistics and computer science. Algorithms that
learn from historical data are either constructed or utilized in machine learning. The performance will rise in
proportion to the quantity of information we provide.
A machine can learn if it can gain more data to improve its performance.
Let's say we have a complex problem in which we need to make predictions. Instead of writing code, we just need
to feed the data to generic algorithms, which build the logic based on the data and predict the output. Our
perspective on the issue has changed as a result of machine learning. The Machine Learning algorithm's operation
is depicted in the following block diagram:
By providing them with a large amount of data and allowing them to automatically explore the data, build
models, and predict the required output, we can train machine learning algorithms. The cost function can be used
to determine the amount of data and the machine learning algorithm's performance. We can save both time and
money by using machine learning.
The significance of AI can be handily perceived by its utilization's cases, Presently, AI is utilized in self-driving
vehicles, digital misrepresentation identification, face acknowledgment, and companion idea by Facebook, and so
on. Different top organizations, for example, Netflix and Amazon have constructed AI models that are utilizing an
immense measure of information to examine the client interest and suggest item likewise.
Following are some key points which show the importance of Machine Learning:
1. Supervised learning
2. Unsupervised learning
3. Reinforcement learning
1) Supervised Learning
In supervised learning, sample labeled data are provided to the machine learning system for training, and the
system then predicts the output based on the training data.
The system uses labeled data to build a model that understands the datasets and learns about each one. After the
training and processing are done, we test the model with sample data to see if it can accurately predict the output.
The mapping of the input data to the output data is the objective of supervised learning. The managed learning
depends on oversight, and it is equivalent to when an understudy learns things in the management of the educator.
Spam filtering is an example of supervised learning.
Supervised learning can be grouped further in two categories of algorithms:
· Classification
· Regression
2) Unsupervised Learning
Unsupervised learning is a learning method in which a machine learns without any supervision.
The training is provided to the machine with the set of data that has not been labeled, classified, or categorized,
and the algorithm needs to act on that data without any supervision. The goal of unsupervised learning is to
restructure the input data into new features or a group of objects with similar patterns.
In unsupervised learning, we don't have a predetermined result. The machine tries to find useful insights from the
huge amount of data. It can be further classifieds into two categories of algorithms:
· Clustering
· Association
3) Reinforcement Learning
Reinforcement learning is a feedback-based learning method, in which a learning agent gets a reward for each
right action and gets a penalty for each wrong action. The agent learns automatically with these feedbacks and
improves its performance. In reinforcement learning, the agent interacts with the environment and explores it. The
goal of an agent is to get the most reward points, and hence, it improves its performance.
The robotic dog, which automatically learns the movement of his arms, is an example of Reinforcement learning.
In simpler terms, ML allows computers to adapt and improve as they are exposed to more data, rather
than following a fixed set of instructions.
· One of the main objectives of machine learning is to automate repetitive and time-consuming
tasks. ML systems can learn from data, identify patterns, and make decisions, thus reducing
human effort in decision-making processes.
· Example: Spam email detection can be automated by using ML models that learn to classify
emails as spam or not based on past examples.
Prediction:
· ML algorithms are commonly used to make predictions based on historical data. The system
learns from existing patterns and applies them to new, unseen data to predict future outcomes.
· Example: Predicting future stock prices based on historical market data.
Pattern Recognition:
· A key objective of machine learning is recognizing patterns and trends in data that are too
complex for humans to detect. These insights can help drive decisions across a wide range of
industries.
· Example: In healthcare, ML can be used to identify patterns in medical records to predict the
likelihood of diseases.
· ML systems are designed to continuously improve their performance over time by learning from
new data. This is achieved through feedback mechanisms and iterative model updates.
· Example: In recommendation systems like Netflix or Amazon, ML algorithms improve their
recommendations by learning from user preferences and behaviors.
· ML systems aim to adapt and respond to dynamic changes in data and environments. They learn
continuously and adjust themselves to accommodate new trends or behaviors.
· Example: Fraud detection systems in banks are updated regularly to adapt to new types of
fraudulent activities.
· One important goal of ML is to categorize or classify data into predefined classes or groups
based on the patterns it learns from the training data.
· Example: Image classification models, such as those used in facial recognition systems, classify
images based on learned features.
Optimization:
· ML is used to optimize tasks and improve efficiency in a wide range of domains, from industrial
processes to logistics.
· Example: ML can be used to optimize routes for delivery trucks, reducing fuel consumption and
time.
· With the increase in the volume and complexity of data, traditional methods become inefficient.
One of the main objectives of ML is to manage, analyze, and derive insights from large datasets.
· Example: Social media platforms analyze massive amounts of data using ML to personalize user
experiences.
· Another important objective is reducing operational costs and time by automating tasks and
optimizing processes.
· Example: Automating customer support through chatbots reduces the need for large customer
service teams.
1. Definition
Supervised Learning:
· In supervised learning, the model is trained on a labeled dataset, which means each training example
comes with a corresponding output (label). The goal is to learn a mapping function that predicts the
output for new, unseen data.
· Example: Predicting house prices based on historical data (features such as size, location) and their
corresponding prices (labels).
Unsupervised Learning:
· In unsupervised learning, the model is provided with data that has no labeled output. The goal is to
explore the underlying structure of the data and find patterns, clusters, or associations.
· Example: Grouping customers based on purchasing behavior (clustering), without predefined labels.
Reinforcement Learning:
· Reinforcement learning involves an agent that interacts with an environment and learns to make decisions
by receiving feedback in the form of rewards or penalties based on its actions. The objective is to
maximize cumulative rewards over time.
· Example: A robot learning to navigate a maze by receiving positive rewards for moving closer to the goal
and penalties for hitting obstacles.
2. Data Type
Supervised Learning:
· Labeled Data: Requires a large amount of labeled data where each input is paired with a corresponding
output (label).
· Example: Dataset with features (inputs) like age, height, and weight, and corresponding labels like
"diabetic" or "non-diabetic."
Unsupervised Learning:
· Unlabeled Data: Uses data that has no associated labels, with the focus being on discovering patterns and
relationships within the data.
· Example: A dataset of images without any classification, where the task is to group similar images
together.
Reinforcement Learning:
· Interaction Data: Relies on interactions with the environment and feedback in the form of rewards or
penalties. There are no fixed labels; instead, the agent learns from experience.
· Example: An autonomous car learning to navigate traffic based on actions and the feedback received
from the environment.
3. Learning Process
Supervised Learning:
· The learning process is based on providing the model with examples of input-output pairs. The model
learns to map inputs to the correct output.
· Process:
· Input data → Model → Predict output (label) → Compare with true output → Adjust model (training).
Unsupervised Learning:
· The model tries to identify hidden patterns or structures within the data without predefined outputs. The
process is more exploratory.
· Process:
· Input data → Model → Group/Cluster/Reduce dimensions → Analyze patterns (no labels involved).
Reinforcement Learning:
· The agent learns through trial and error by interacting with the environment. It takes actions, observes the
outcome, and receives rewards or penalties. The goal is to find the best strategy to maximize rewards.
· Process:
· Agent → Takes action → Environment → Feedback (reward/penalty) → Adjust behavior.
4. Goals
Supervised Learning:
· Goal: Learn a mapping from inputs to outputs so that the model can make accurate predictions for new,
unseen data. The emphasis is on minimizing the difference between predicted and actual labels.
Unsupervised Learning:
· Goal: Find the hidden structure or patterns within the data. This could involve grouping similar data
points (clustering) or reducing data complexity (dimensionality reduction).
Reinforcement Learning:
· Goal: Learn a policy (set of rules) that maximizes the cumulative reward by making the right decisions at
each step in an environment.
5. Examples of Algorithms
Supervised Learning:
· Algorithms:
· Classification: Logistic Regression, Support Vector Machines (SVM), Decision Trees, Random Forests,
Neural Networks.
· Regression: Linear Regression, Ridge Regression, Lasso, Support Vector Regression.
· Examples: Email spam detection, Image classification, Medical diagnosis.
Unsupervised Learning:
· Algorithms:
· Clustering: K-Means, Hierarchical Clustering, DBSCAN.
· Dimensionality Reduction: Principal Component Analysis (PCA), t-SNE, Autoencoders.
· Examples: Customer segmentation, Anomaly detection, Market basket analysis.
Reinforcement Learning:
· Algorithms:
· Q-Learning, Deep Q Networks (DQN), Policy Gradient Methods, Actor-Critic Methods.
· Examples: Game playing (e.g., AlphaGo), Autonomous vehicles, Robotics control.
6. Applications
Supervised Learning:
· Applications:
· Email Filtering: Classifying emails as spam or not spam.
· Fraud Detection: Identifying fraudulent transactions based on historical labeled data.
· Medical Diagnosis: Predicting disease based on patient symptoms and historical data.
Unsupervised Learning:
· Applications:
· Customer Segmentation: Grouping customers based on purchasing behavior for targeted marketing.
· Anomaly Detection: Detecting unusual patterns in data (e.g., fraud, network intrusions).
· Recommendation Systems: Identifying latent features to recommend products to users.
Reinforcement Learning:
· Applications:
· Robotics: Teaching robots to perform tasks by maximizing rewards in various environments.
· Autonomous Vehicles: Self-driving cars learn to navigate safely through trial and error.
· Game AI: Training agents to play complex games like chess or Go with strategies developed over time.
7. Advantages
Supervised Learning:
Unsupervised Learning:
Reinforcement Learning:
8. Disadvantages
Supervised Learning:
· Requires a large amount of labeled data, which can be expensive and time-consuming to obtain.
· Not suitable for tasks without clearly defined output labels.
Unsupervised Learning:
Reinforcement Learning:
9. Feedback Type
Supervised Learning:
· Explicit Feedback: The model learns from labeled data where the true outcome is known.
Unsupervised Learning:
· No Explicit Feedback: The model has no ground truth labels to guide learning; it identifies patterns
without supervision.
Reinforcement Learning:
· Delayed Feedback: The agent receives feedback in the form of rewards or penalties based on its actions,
but the feedback can be delayed over time.
Summary Table:
Aspect Supervised Learning Unsupervised Learning Reinforcement Learning
Data Type Labeled data Unlabeled data Interaction data
Learning Learn by interacting with the
Learn from input-output pairs Discover hidden patterns
Process environment
Goal Map inputs to outputs Find structure/patterns Maximize cumulative rewards
Clustering, dimensionality
Examples Classification, regression Robotics, game playing
reduction
Feedback Delayed feedback
Explicit feedback (labeled) No feedback (unlabeled)
Type (rewards/penalties)
High accuracy, applicable for Suitable for dynamic
Advantages Uncovers hidden patterns
many tasks environments
Computationally expensive,
Disadvantages Requires large labeled datasets Harder to interpret results
slow
Key Characteristics:
Labeled Data:
· Supervised learning requires a dataset where each input is associated with a corresponding label (output).
For example, in a classification problem, each image might be labeled as a "cat" or "dog."
· The goal of supervised learning is to approximate a mapping function from input to output using the
labeled data. This function is then used to predict outputs for new, unseen inputs.
Types of Problems:
· The dataset is usually split into a training set to teach the model and a test set to evaluate its
performance.
Feedback:
· The learning is guided by feedback in the form of errors between the predicted output and the actual
output (i.e., the label). The model is adjusted based on this feedback during training.
Goal:
· Minimize the error in predictions by learning the underlying relationships between input features and
output labels.
Key Characteristics:
Unlabeled Data:
· The algorithm is provided with data that lacks labels, and it tries to discover the structure of the data on its
own.
Pattern Discovery:
· The goal is not prediction but rather pattern recognition, such as identifying clusters, correlations, or
associations in the data.
Types of Problems:
· Clustering: Grouping data points that are similar to each other (e.g., segmenting customers based on
purchasing behavior).
· Dimensionality Reduction: Reducing the number of features in the dataset while preserving important
information (e.g., Principal Component Analysis).
· Association: Identifying relationships between variables in large datasets (e.g., market basket analysis for
finding frequent itemsets).
No Direct Feedback:
· Unlike supervised learning, there is no direct feedback from labeled outputs. The model is assessed based
on how well it identifies patterns or structures in the data.
Goal:
· To uncover hidden patterns or structures in the data and use them to organize the data into meaningful
groups or reduce the complexity of the data.
Key Characteristics:
Agent and Environment:
· The agent is the learner or decision-maker, while the environment represents the external system that the
agent interacts with. The agent takes actions in the environment to achieve a goal.
· The environment is described in terms of states. The agent takes actions to transition between states and
receives rewards (positive or negative) based on the actions it takes.
· The goal of the agent is to learn a policy that maximizes the total accumulated reward over time.
Sequential Decision-Making:
· The agent makes decisions over time, and each action impacts the next state. Thus, the learning process is
about optimizing long-term rewards rather than just immediate rewards.
· The agent must balance exploration (trying new actions to discover their effects) with exploitation
(using known actions that lead to high rewards).
· Too much exploitation may prevent the agent from finding better actions, while too much exploration can
slow down the learning process.
Delayed Rewards:
· Rewards may not be immediate. Some actions may lead to rewards only after a sequence of steps, making
the problem more challenging to solve.
· RL problems are often modeled as a Markov Decision Process (MDP), where the future state depends
only on the current state and action (not the entire history).
· The agent improves its policy through interaction with the environment, updating its knowledge based on
the rewards received.
Types of Learning:
· Model-free RL: The agent learns purely from experience, without an explicit model of the environment
(e.g., Q-learning).
· Model-based RL: The agent learns a model of the environment and uses it to plan future actions (e.g.,
Dynamic Programming).
Goal:
· The agent aims to learn an optimal policy that maximizes cumulative rewards over time.