0% found this document useful (0 votes)
4 views7 pages

Machine Learning Types

The document provides an overview of three main branches of machine learning: Supervised Learning, Unsupervised Learning, and Reinforcement Learning. It details the mechanics, tasks, algorithms, and evaluation metrics associated with each learning type, including regression and classification for supervised learning, clustering and association rule learning for unsupervised learning, and the reinforcement learning process. Each section outlines key concepts and specific algorithms used in these learning paradigms.

Uploaded by

neha7wang
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

Machine Learning Types

The document provides an overview of three main branches of machine learning: Supervised Learning, Unsupervised Learning, and Reinforcement Learning. It details the mechanics, tasks, algorithms, and evaluation metrics associated with each learning type, including regression and classification for supervised learning, clustering and association rule learning for unsupervised learning, and the reinforcement learning process. Each section outlines key concepts and specific algorithms used in these learning paradigms.

Uploaded by

neha7wang
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1.

Supervised Learning

Supervised Learning is the most common and well-understood branch of


ML. The goal is to learn a mapping function from input (X) to output (Y) so
well that when you get new input (X), you can accurately predict the
output (Y).

How it Works (The Mechanics):

1. Data Collection: Gather a dataset where each example has


features (input variables) and a label (the target output).

2. Training: Feed this labeled data into a supervised learning


algorithm. The algorithm makes predictions on the training data and
compares its predictions to the actual labels. The difference
between its prediction and the actual label is the error or loss.

3. Learning (Optimization): The algorithm adjusts its internal


parameters to minimize this error. This process is repeated many
times across the entire dataset (epochs) until the model's
performance is satisfactory.

4. Evaluation: The final model is tested on a separate test set (data


it has never seen) to evaluate how well it generalizes to new,
unseen examples.

Deeper Dive into the Two Main Tasks:

A. Regression (Predicting Continuous Values)

 Goal: To predict a number on a continuous scale.

 How it thinks: It tries to find the "line of best fit" or curve through
the data points. The quality of the fit is often measured by the
distance between the predicted line and the actual data points.

 Evaluation Metrics:

o Mean Absolute Error (MAE): The average of the absolute


differences between prediction and actual value.

o Mean Squared Error (MSE): The average of the squared


differences (penalizes larger errors more heavily).

o R-squared (R²): Indicates how well the independent


variables explain the variability of the dependent variable (a
measure of fit).

 Algorithms & How They Work:


o Linear Regression: Fits a straight line (Y = aX + b) to the
data. Simple, fast, but assumes a linear relationship.

o Polynomial Regression: Fits a curved line (Y = aX² + bX +


c) to capture more complex, non-linear relationships.

o Support Vector Regression (SVR): Similar to SVM for


classification, but it tries to fit as many data points as
possible within a "tube" or margin of tolerance, rather than
caring about points far outside the tube.

o Decision Trees (Regression): Splits the data into smaller


and smaller subsets based on feature values, creating a tree-
like structure. The prediction for a new point is the average
value of the training points in the final "leaf" node.

B. Classification (Predicting Categories)

 Goal: To assign an input to a discrete class or category.

 How it thinks: It tries to find a decision boundary that best


separates the different classes. For example, in 2D space, it might
try to draw a line that separates "cats" from "dogs".

 Evaluation Metrics:

o Accuracy: The percentage of correct predictions. (Good for


balanced datasets, but misleading for imbalanced ones).

o Precision: Of all the positive predictions made, how many


were actually positive? (e.g., Of all emails flagged as spam,
how many were really spam?)

o Recall (Sensitivity): Of all the actual positive cases, how


many did we correctly identify? (e.g., Of all the actual spam
emails, how many did we catch?)

o F1-Score: The harmonic mean of Precision and Recall (a


balanced metric).

o Confusion Matrix: A table showing correct vs. incorrect


predictions for each class.

 Algorithms & How They Work:

o Logistic Regression: Despite its name, it's for classification.


It applies a sigmoid function to the output of a linear model to
squash the result between 0 and 1, representing the
probability of belonging to a class.
o k-Nearest Neighbors (kNN): A "lazy learner." It doesn't
build a model during training. Instead, it memorizes the entire
dataset. To classify a new point, it looks at the 'k' closest
points in the training data and takes a majority vote.

o Support Vector Machines (SVM): Finds the "best" decision


boundary (a hyperplane) that has the maximum margin—
the largest possible distance to the nearest data points of any
class (called support vectors). It can use "kernels" to find
boundaries in high dimensions.

o Naive Bayes: Based on Bayes' Theorem with a "naive"


assumption that all features are independent of each other. It
calculates the probability of a data point belonging to a class
based on the probabilities of its features. Very popular for text
classification.

o Random Forest: An ensemble method that builds hundreds


of decision trees on slightly different subsets of the data and
averages their results. This reduces overfitting and is very
powerful.

o Neural Networks: A complex web of interconnected nodes


(neurons) arranged in layers. They can learn incredibly
complex, non-linear relationships, forming intricate decision
boundaries.

2. Unsupervised Learning

Unsupervised Learning is about exploring data and finding structure


without any guidance. The goal is to model the underlying structure or
distribution of the data in order to learn more about it.

How it Works (The Mechanics):

1. Data Collection: Gather a dataset consisting only of input


features (X). There are no labels.

2. Training: The algorithm is tasked with finding patterns, groupings,


or structures on its own. It might try to group similar points, find
frequently co-occurring items, or simplify the data while retaining its
essential characteristics.

3. Interpretation: The results must be interpreted by a human. The


algorithm can show you that there are groups, but it's up to you to
understand what those groups mean (e.g., "Group 1 are young,
high-income spenders").

Deeper Dive into the Main Tasks:

A. Clustering

 Goal: To partition a set of objects into groups (clusters) such that


objects in the same group are more similar to each other than to
those in other groups.

 How it thinks: It uses a measure of similarity or distance (e.g.,


Euclidean distance) to group data points. Points that are "close" in
the feature space are likely to be in the same cluster.

 Algorithms & How They Work:

o k-Means:

1. You choose the number of clusters k.

2. The algorithm randomly places k points in the feature


space (centroids).

3. It assigns every data point to its nearest centroid,


forming k clusters.

4. It moves the centroids to the center of their newly


formed clusters.

5. Steps 3 and 4 are repeated until the centroids stop


moving.

o Hierarchical Clustering:

 Agglomerative (Bottom-up): Starts with each point


as its own cluster and then repeatedly merges the two
closest clusters until only one cluster remains.

 Divisive (Top-down): Starts with one big cluster and


recursively splits it.

 The result is a tree-like diagram called a dendrogram,


which is very informative for understanding the data's
structure.

o DBSCAN (Density-Based Spatial Clustering of


Applications with Noise):

 Groups together points that are closely packed together


(points with many nearby neighbors), marking as
outliers points that lie alone in low-density regions. It's
great for finding arbitrarily shaped clusters and handling
noise.

B. Association Rule Learning

 Goal: To discover interesting relationships (rules) between variables


in large databases.

 How it thinks: It looks for combinations of items that frequently


appear together.

 Metrics:

o Support: How frequently the itemset appears in the data.

o Confidence: How often the rule is found to be


true. Confidence(A → B) = P(B | A).

o Lift: How much more likely B is to be bought when A is


bought, compared to B being bought independently. Lift >
1 indicates a positive association.

 Algorithms & How They Work:

o Apriori Algorithm:

1. Find all itemsets that meet a


minimum support threshold (e.g., "Milk" and "Bread"
appear together in at least 5% of transactions).

2. Use these frequent itemsets to generate association


rules, like {Milk} -> {Bread}.

3. Keep only the rules that meet a


minimum confidence threshold (e.g., 80% of the time
someone buys Milk, they also buy Bread).

C. Dimensionality Reduction

 Goal: To reduce the number of random variables under


consideration, while preserving as much of the data's important
information as possible.

 Why? To combat the "curse of dimensionality" (where having too


many features makes models less effective), for data visualization,
and to speed up computation.

 Algorithms & How They Work:

o Principal Component Analysis (PCA): A statistical


technique that creates new, uncorrelated variables (principal
components) that are linear combinations of the original ones.
The first principal component captures the maximum variance
in the data, the second captures the next largest, and so on.
You can then keep only the top few components.

o t-SNE (t-distributed Stochastic Neighbor Embedding): A


non-linear technique specifically for visualizing high-
dimensional data in a low-dimensional space (usually 2D or
3D). It tries to preserve the local structure of the data,
meaning points that are close in the high-dimensional space
remain close in the low-dimensional map.

3. Reinforcement Learning

Reinforcement Learning is different from the other two. It's about learning
how to act in an environment to maximize a cumulative reward. It's the
closest to how humans and animals learn.

How it Works (The Mechanics):

1. Initial State: The agent observes the current state (S) of the
environment.

2. Action: Based on its policy, the agent chooses an action (A).

3. Feedback Loop: The environment transitions to a new


state (S') and provides a reward (R) to the agent. The reward can
be positive or negative.

4. Learning: The agent updates its knowledge and its policy based on
the reward received. The goal is to learn a policy that maximizes the
total cumulative reward (return) over the long run. This involves
balancing exploration (trying new actions to see their effect)
and exploitation (using known actions that yield high rewards).

Key Concepts and Algorithms:

 Markov Decision Process (MDP): The mathematical framework


for modeling RL problems. It includes states, actions, transition
probabilities, and rewards.

 The Policy (π): The agent's strategy. It's a mapping from states to
actions. It can be deterministic (one action per state) or stochastic
(a probability distribution over actions).

 The Value Function (V): Predicts the expected future reward an


agent will get from being in a given state.
 The Q-Value / Action-Value Function (Q): Predicts the expected
future reward an agent will get from being in a given state and
taking a specific action. This is a core concept in many algorithms.

 Algorithms & How They Work:

o Q-Learning: A classic model-free RL algorithm. It learns an


optimal Q-function (a table of Q-values for every state-action
pair). The agent updates the Q-value for a (state, action) pair
based on the immediate reward received and the maximum Q-
value of the next state. It doesn't need a model of the
environment's dynamics.

o Deep Q-Networks (DQN): An extension of Q-Learning for


problems with a huge number of states (like pixels in a video
game). Instead of a table, it uses a deep neural network to
approximate the Q-function. This was the breakthrough that
allowed AI to master Atari games.

o Policy Gradients: Instead of learning a value function, these


methods directly learn the optimal policy (π) by adjusting its
parameters. The agent tries actions and updates the policy to
make actions that led to higher rewards more likely in the
future. This is good for continuous action spaces.

You might also like