0% found this document useful (0 votes)
32 views69 pages

Understanding Machine Learning Basics

Machine Learning (ML) is a subset of artificial intelligence focused on algorithms that improve through experience and data. The ML process involves stages such as data collection, preprocessing, model training, and deployment, with types including supervised, unsupervised, and reinforcement learning. ML is crucial for solving complex problems, handling large data volumes, automating tasks, and enhancing user experiences across various industries.

Uploaded by

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

Understanding Machine Learning Basics

Machine Learning (ML) is a subset of artificial intelligence focused on algorithms that improve through experience and data. The ML process involves stages such as data collection, preprocessing, model training, and deployment, with types including supervised, unsupervised, and reinforcement learning. ML is crucial for solving complex problems, handling large data volumes, automating tasks, and enhancing user experiences across various industries.

Uploaded by

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

Machine Learning

Machine Learning, often abbreviated as ML, is a subset of artificial intelligence (AI) that
focuses on the development of computer algorithms that improve automatically through
experience and by the use of data. In simpler terms, machine learning enables computers to
learn from data and make decisions or predictions without being explicitly programmed to
do so.

At its core, machine learning is all about creating and implementing algorithms that facilitate
these decisions and predictions. These algorithms are designed to improve their
performance over time, becoming more accurate and effective as they process more data.

How does Machine Learning Work?


Machine Learning process includes Project Setup, Data Preparation, Modeling and
Deployment. The following figure demonstrates the common working process of Machine
Learning. It follows some set of steps to do the task; a sequential process of its workflow is
as follows:

Stages of Machine Learning


The following are the stages (detailed sequential process) of Machine Learning:
Data Collection − Data collection is an initial step in the process of machine learning. In this
stage, it collects data from the different sources such as databases, text files, pictures, sound
files, or web scraping. This process organizes the data in an appropriate format, such as a
CSV file or database, and makes sure that they are useful for solving your problem.

Data Pre-processing − It is a key step in the process of machine learning, which involves
deleting duplicate data, fixing errors, managing missing data either by eliminating or filling it
in, and adjusting and formatting the data.

Choosing the Right Model − The next step is to select a machine learning model; once data
is prepared, then we apply it to ML models like linear regression, decision trees, and neural
networks that may be selected to implement. This selection depends on many factors, such
as the kind of data and your problem, the size and type of data, the complexity, and the
computational resources.

Training the Model − This step includes training the model from the data so it can make
better predictions.

Evaluating the model − When module is trained, the model has to be tested on new data
that they haven't been able to see during training.

Hyperparameter Tuning and Optimization − After evaluating the model, you may need to
adjust its hyperparameters to make it more efficient. You should try different combinations
of parameters and cross-validation to ensure that the model performs well on different data
sets.
Predictions and Deployment − When the model has been programmed and optimized, it
will be ready to estimate new data. This is done by adding new data to the model and using
its output for decision-making or other analysis. The deployment includes its integration into
a production environment to make it capable of processing real-world data.

Types of Machine Learning


Machine learning can be broadly classified into three types based on the nature of the
learning system and the data available: supervised learning, unsupervised learning, and
reinforcement learning.

Supervised learning

Supervised learning is the most common type of machine learning. In this approach, the
model is trained on a labeled dataset. In other words, the data is accompanied by a label
that the model is trying to predict. This could be anything from a category label to a real-
valued number.
The model learns a mapping between the input (features) and the output (label) during the
training process. Once trained, the model can predict the output for new, unseen data.

Common examples of supervised learning algorithms include linear regression for regression
problems and logistic regression, decision trees, and support vector machines for
classification problems. In practical terms, this could look like an image recognition process,
wherein a dataset of images where each picture is labeled as "cat," "dog," etc., a supervised
model can recognize and categorize new images accurately.

Unsupervised learning

Unsupervised learning, on the other hand, involves training the model on an unlabeled
dataset. The model is left to find patterns and relationships in the data on its own.

This type of learning is often used for clustering and dimensionality reduction. Clustering
involves grouping similar data points together, while dimensionality reduction involves
reducing the number of random variables under consideration by obtaining a set of principal
variables.

Common examples of unsupervised learning algorithms include k-means for clustering


problems and Principal Component Analysis (PCA) for dimensionality reduction problems.
Again, in practical terms, in the field of marketing, unsupervised learning is often used to
segment a company's customer base. By examining purchasing patterns, demographic data,
and other information, the algorithm can group customers into segments that exhibit similar
behaviors without any pre-existing labels.

Reinforcement learning
Reinforcement learning is a type of machine learning where an agent learns to make
decisions by interacting with its environment. The agent is rewarded or penalized (with
points) for the actions it takes, and its goal is to maximize the total reward.

Unlike supervised and unsupervised learning, reinforcement learning is particularly suited to


problems where the data is sequential, and the decision made at each step can affect future
outcomes.

Common examples of reinforcement learning include game playing, robotics, resource


management, and many more.

Besides these three main types, modern machine learning also includes two other important
approaches: Self-Supervised Learning and Semi-Supervised Learning.

Semi-Supervised Learning: Supervised + Unsupervised Learning


Semi-Supervised learning Semi-Supervised Learning combines both Supervised and
Unsupervised approaches. It uses a small set of labeled data and a large set of unlabeled
data for training useful when labeling is costly or time-consuming.
Example: Consider that we are building a language translation model, having labeled
translations for every sentence pair can be resources intensive. It allows the models to learn
from labeled and unlabeled sentence pairs, making them more accurate. This technique has
led to significant improvements in the quality of machine translation services.

Self-Supervised Learning
Self-Supervised Learning (SSL) is a modern approach where models generate their own
labels from raw data. It doesn’t rely on manual annotation instead, the model learns by
predicting parts of data from other parts.

Example: In NLP, models like BERT or GPT learn by predicting masked words in sentences,
using surrounding context as supervision. This helps them learn language understanding
without human labelling.

Why do we need Machine Learning?


Traditional programming requires exact instructions and doesn’t handle complex tasks like
understanding images or language well. It can’t efficiently process large amounts of data.
Machine Learning solves these problems by learning from examples and making predictions
without fixed rules. Let's see various reasons why it is important:

1. Solving Complex Business Problems

Traditional programming struggles with tasks like language understanding and medical
diagnosis. ML learns from data and predicts outcomes easily.

Examples:

• Image and speech recognition in healthcare.

• Language translation and sentiment analysis.

2. Handling Large Volumes of Data

The internet generates huge amounts of data every day. Machine Learning processes and
analyzes this data quickly by providing valuable insights and real-time predictions.

Examples:

• Fraud detection in financial transactions.

• Personalized feed recommendations on Facebook and Instagram from billions of


interactions.

3. Automate Repetitive Tasks


ML automates time-consuming, repetitive tasks with high accuracy hence reducing manual
work and errors.

Examples:

• Gmail filtering spam emails automatically.

• Chatbots handling order tracking and password resets.

• Automating large-scale invoice analysis for key insights.

4. Personalized User Experience

ML enhances user experience by tailoring recommendations to individual preferences. It


analyze user behavior to deliver highly relevant content.

Examples:

• Netflix suggesting movies and TV shows based on our viewing history.

• E-commerce sites recommending products we're likely to buy.

5. Self Improvement in Performance

ML models evolve and improve with more data helps in making them smarter over time.
They adapt to user behavior and increase their performance.

Examples:

• Voice assistants like Siri and Alexa learning our preferences and accents.

• Search engines refining results based on user interaction.

• Self-driving cars improving decisions using millions of miles of driving data.

Importance of Data in Machine Learning


Data is the foundation of machine learning (ML) without quality data ML models cannot
learn, perform or make accurate predictions.

• Data provides the examples from which models learn patterns and relationships.

• High-quality and diverse data improves how well models perform and generalize to
new situations.

• It helps models to understand real-world scenarios and adapt to practical uses.

• Features extracted from data are important for effective training.

• Separate datasets for validation and testing measure how well the model works on
unseen data.
• Data drives continuous improvements in models through feedback loops.

Benefits of Machine Learning


1. Enhanced Efficiency and Automation: ML automates repetitive tasks, freeing up
human resources for more complex work. This leads to faster, smoother processes
and higher productivity.

2. Data-Driven Insights: It can analyze large amounts of data to identify patterns and
trends that might be missed by people and help businesses make better decisions.

3. Improved Personalization: It customizes user experiences by tailoring


recommendations and ads based on individual preferences.

4. Advanced Automation and Robotics: It helps robots and machines to perform


complex tasks with greater accuracy and adaptability. This is transforming industries
like manufacturing and logistics.

Challenges of Machine Learning


1. Data Bias and Fairness: ML models learn from training data and if the data is biased,
model’s decisions can be unfair so it’s important to select and monitor data carefully.

2. Security and Privacy Concerns: Since it depends on large amounts of data, there is a
risk of sensitive information being exposed so protecting privacy is important.

3. Interpretability and Explainability: Complex ML models can be difficult to


understand which makes it difficult to explain why they make certain decisions. This
can affect trust and accountability.

4. Job Displacement and Automation: Automation may replace some jobs so retraining
and helping workers learn new skills is important to adapt to these changes.

Applications of Machine Learning


Machine Learning is used in many industries to solve problems and improve services. Here
are some common real-world applications:

1. Healthcare: It helps doctors to diagnose diseases from medical images like X-rays and
MRIs. It also predicts patient outcomes and personalizes treatments which improves
healthcare quality.
2. Finance: In finance it detects fraudulent transactions in real time and supports
algorithmic trading. It also helps to assess credit risk helps in making lending safer
and faster.

3. Retail and E-Commerce: It helps in personalized product recommendations and


forecasts demand to optimize inventory and also analyzes customer sentiment to
improve shopping experiences.

4. Transportation and Automotive: Self-driving cars rely on ML to navigate and make


decisions. It optimizes delivery routes and predicts vehicle maintenance needs which
reduces downtime.

5. Social Media and Entertainment: Platforms like Netflix and YouTube use ML to
recommend content we'll enjoy. It enables image and speech recognition for better
user interaction.

6. Manufacturing: It improves quality control by detecting defects in products


automatically and predicts machine failures in advance and helps in production
processes.
Supervised Machine Learning
Supervised learning is a type of machine learning where a model learns from labelled data—
meaning every input has a corresponding correct output. The model makes predictions and
compares them with the true outputs, adjusting itself to reduce errors and improve accuracy
over time. The goal is to make accurate predictions on new, unseen data. For example, a
model trained on images of handwritten digits can recognise new digits it has never seen
before.

Working of Supervised Machine Learning


The working of supervised machine learning follows these key steps:

1. Collect Labeled Data

• Gather a dataset where each input has a known correct output (label).

• Example: Images of handwritten digits with their actual numbers as labels.

2. Split the Dataset

• Divide the data into training data (about 80%) and testing data (about 20%).

• The model will learn from the training data and be evaluated on the testing data.

3. Train the Model


• Feed the training data (inputs and their labels) to a suitable supervised learning
algorithm (like Decision Trees, SVM or Linear Regression).

• The model tries to find patterns that map inputs to correct outputs.
4. Validate and Test the Model
• Evaluate the model using testing data it has never seen before.

• The model predicts outputs and these predictions are compared with the actual
labels to calculate accuracy or error.

5. Deploy and Predict on New Data


• Once the model performs well, it can be used to predict outputs for completely new,
unseen data.

Types of Supervised Learning in Machine Learning

Classification
Classification is a supervised machine learning technique used to predict labels or categories
based on input data. The goal is to assign each data point to a predefined class, such as
spam vs. non-spam emails or diseased vs. healthy patients.

For example, a classification model might be trained on dataset of images labeled as either
dogs or cats and it can be used to predict the class of new and unseen images as dogs or cats
based on their features such as colour, texture or shape.

Types of Classification
When we talk about classification in machine learning, we’re talking about the process of
sorting data into categories based on specific features or characteristics. There are different
types of classification problems depending on how many categories (or classes) we are
working with and how they are organized.

1. Binary Classification
This is the simplest kind of classification. In binary classification, the goal is to sort the data
into two distinct categories. Think of it like a simple choice between two options. Imagine a
system that sorts emails into either spam or not spam. It works by looking at different
features of the email like certain keywords or sender details and decides whether it’s spam
or not. It only chooses between these two options.

2. Multiclass Classification
Here, instead of just two categories, the data needs to be sorted into more than two
categories. The model picks the one that best matches the input. Think of an image
recognition system that sorts pictures of animals into categories like cat, dog and bird.

3. Multi-Label Classification
In multi-label classification single piece of data can belong to multiple categories at once.
Unlike multiclass classification where each data point belongs to only one class, multi-label
classification allows datapoints to belong to multiple classes. A movie recommendation
system could tag a movie as both action and comedy. The system checks various features
(like movie plot, actors or genre tags) and assigns multiple labels to a single piece of data,
rather than just one.

4. Imbalanced classification
Imbalanced classification, in which some categories contain more data points than others,
requires a specialized approach. As certain groups amass more data points, some
classification models become biased toward those groups and increasingly predict in their
favor.

Classification Algorithms
1. Linear Classifiers: Linear classifier models create a linear decision
boundary between classes. They are simple and computationally efficient.
2. Non-linear Classifiers: Non-linear models create a non-linear decision
boundary between classes. They can capture more complex relationships
between input features and target variable.

Some of the top-ranked machine learning algorithms for Classification are:


1. Logistic Regression
In Logistic regression is classification algorithm used to estimate discrete values, typically
binary, such as 0 and 1, yes or no. It predicts the probability of an instance belonging to a
class that makes it essectial for binary classification problems like spam detection or
diagnosing disease.

Logistic functions are ideal for classification problems since their output is between 0 and
1. Many fields employ it because of its simplicity, interpretability, and efficiency. Logistic
Regression works well when features and event probability are linear. Logistic Regression
used for binary classification tasks. A logistic function models probability in this linear model.

2. Decision Tree
Decision Trees are versatile and simple classification and regression techniques. Recursively
splitting the dataset into key-criteria subgroups provides a tree-like structure. Judgments at
each node produce leaf nodes. Decision trees are easy to understand and depict, making
them useful for decision-making. A tree-like model of decisions and their consequences,
including chance event outcomes, resource costs and utility.

3. Random Forest
Random forest are an ensemble learning techniques that combines multiple decision trees
to improve predictive accuracy and control over-fitting. By aggregating the predictions of
numerous trees, Random Forests enhance the decision-making process, making them robust
against noise and bias.

Random Forest uses numerous decision trees to increase prediction accuracy and reduce
overfitting. It constructs many trees and integrates their predictions to create a reliable
model. Diversity is added by using a random dataset and characteristics in each tree.
Random Forests excel at high-dimensional data, feature importance metrics, and overfitting
resistance. Many fields use them for classification and regression.
[Link] Vector Machine (SVM)
SVM is an effective classification and regression algorithm. It seeks the hyperplane that best
classifies data while increasing the margin. SVM works well in high-dimensional areas and
handles nonlinear feature interactions with its kernel technique. It is powerful classification
algorithm known for their accuracy in high-dimensional spaces

SVM is robust against overfitting and generalizes well to different datasets. It finds
applications in image recognition, text classification, and bioinformatics, among other fields.
Its use cases span image recognition, text categorization, and bioinformatics, where
precision is paramount.

[Link] Bayes
Text categorization and spam filtering benefit from Bayes theorem-based probabilistic
classification algorithm Naive Bayes. Despite its simplicity and "naive" assumption of feature
independence, Naive Bayes often works well in practice. It uses conditional probabilities of
features to calculate the class likelihood of an instance. Naive Bayes handles high-
dimensional datasets quickly.

Naive Bayes which describes the probability of an event, based on prior knowledge of
conditions that might be related to the event. Naive Bayes classifiers assume that the
presence (or absence) of a particular feature of a class is unrelated to the presence (or
absence) of any other feature, given the class variable

6.K-Nearest Neighbors (KNN)


KNN uses the majority class of k-nearest neighbours for easy and adaptive classification and
regression. Non-parametric KNN has no data distribution assumptions. It works best with
uneven decision boundaries and performs well for varied jobs. K-Nearest Neighbors (KNN) is
an instance-based, or lazy learning algorithm, where the function is only approximated
locally, and all computation is deferred until function evaluation. It classifies new cases
based on a similarity measure (e.g., distance functions). KNN is widely used in
recommendation systems, anomaly detection, and pattern recognition due to its simplicity
and effectiveness in handling non-linear data.

Examples of Machine Learning Classification in Real Life


Classification algorithms are widely used in many real-world applications across various
domains, including:

• Email spam filtering: Filters our emails into spam or not spam based on email
content.

• Credit risk assessment: Algorithms predict whether a loan applicant is likely to


default by analyzing factors such as credit score, income and loan history. This helps
banks make informed lending decisions and minimize financial risk.

• Medical diagnosis: Machine learning models classify whether a patient has a certain
condition like cancer or diabetes based on medical data such as test results,
symptoms and patient history. This aids doctors in making quicker, more accurate
diagnoses, improving patient care.

• Image classification : Applied in fields such as facial recognition, autonomous driving


and medical imaging.

• Sentiment analysis: Determining whether the sentiment of a piece of text is positive,


negative or neutral. Businesses use this to understand customer opinions, helping to
improve products and services.

• Fraud detection : Algorithms detect fraudulent activities by analyzing transaction


patterns and identifying anomalies crucial in protecting against credit card fraud and
other financial crimes.
• Recommendation systems : Used to recommend products or content based on past
user behavior, such as suggesting movies on Netflix or products on Amazon. This
personalization boosts user satisfaction and sales for businesses.

Regression
Regression in machine learning refers to a supervised learning technique where the goal is
to predict a continuous numerical value based on one or more independent features. It finds
relationships between variables so that predictions can be made. we have two types of
variables present in regression:

• Dependent Variable (Target): The variable we are trying to predict e.g house price.

• Independent Variables (Features): The input variables that influence the prediction
e.g locality, number of rooms.

Regression analysis problem works with if output variable is a real or continuous value such
as “salary” or “weight”. Many different regression models can be used but the simplest
model in them is linear regression.

Types of Regression
Regression can be classified into different types based on the number of predictor variables
and the nature of the relationship between variables:

1. Simple Linear Regression


Linear regression is one of the simplest and most widely used statistical models. This
assumes that there is a linear relationship between the independent and dependent
variables. This means that the change in the dependent variable is proportional to the
change in the independent variables. For example predicting the price of a house based on
its size.

2. Multiple Linear Regression


Multiple linear regression extends simple linear regression by using multiple independent
variables to predict target variable. For example predicting the price of a house based on
multiple features such as size, location, number of rooms, etc.

3. Polynomial Regression
Polynomial regression is used to model with non-linear relationships between the
dependent variable and the independent variables. It adds polynomial terms to the linear
regression model to capture more complex relationships. For example when we want to
predict a non-linear trend like population growth over time we use polynomial regression.
4. Ridge & Lasso Regression
Ridge & lasso regression are regularized versions of linear regression that help avoid
overfitting by penalizing large coefficients. When there’s a risk of overfitting due to too many
features we use these type of regression algorithms.

5. Support Vector Regression (SVR)


SVR is a type of regression algorithm that is based on the Support Vector Machine (SVM)
algorithm. SVM is a type of algorithm that is used for classification tasks but it can also be
used for regression tasks. SVR works by finding a hyperplane that minimizes the sum of the
squared residuals between the predicted and actual values.

6. Decision Tree Regression


Decision tree Uses a tree-like structure to make decisions where each branch of tree
represents a decision and leaves represent outcomes. For example predicting customer
behavior based on features like age, income, etc there we use decison tree regression.

7. Random Forest Regression


Random Forest is a ensemble method that builds multiple decision trees and each tree is
trained on a different subset of the training data. The final prediction is made by averaging
the predictions of all of the trees. For example customer churn or sales data using this.

Regression Evaluation Metrics


Evaluation in machine learning measures the performance of a model. Here are some
popular evaluation metrics for regression:

• Mean Absolute Error (MAE): The average absolute difference between the
predicted and actual values of the target variable.
• Mean Squared Error (MSE): The average squared difference between the
predicted and actual values of the target variable.
• Root Mean Squared Error (RMSE): Square root of the mean squared error.
• Huber Loss: A hybrid loss function that transitions from MAE to MSE for larger
errors, providing balance between robustness and MSE’s sensitivity to outliers.
• R2 – Score: Higher values indicate better fit ranging from 0 to 1.

Applications of Regression
• Predicting prices: Used to predict the price of a house based on its size, location and
other features.

• Forecasting trends: Model to forecast the sales of a product based on historical sales
data.

• Identifying risk factors: Used to identify risk factors for heart patient based on
patient medical data.

• Making decisions: It could be used to recommend which stock to buy based on


market data.

Advantages of Regression
• Easy to understand and interpret.

• Robust to outliers.

• Can handle both linear relationships easily.

Disadvantages of Regression
• Assumes linearity.

• Sensitive to situation where two or more independent variables are highly correlated
with each other i.e multicollinearity.

• May not be suitable for highly complex relationships.

Let's summarize the supervised machine learning algorithms in table:

Regression,
Algorithm Classification Purpose Method Use Cases

Linear equation
Predict Predicting
minimizing sum of
Regression continuous continuous
Linear squares of
output values values
Regression residuals

Logistic function Binary


Predict binary
Logistic Classification transforming classification
output variable
Regression linear relationship tasks
Regression,
Algorithm Classification Purpose Method Use Cases

Tree-like structure Classification


Model decisions
Decision Both with decisions and and Regression
and outcomes
Trees outcomes tasks

Reducing
Improve
Combining overfitting,
classification and
Both multiple decision improving
regression
Random trees prediction
accuracy
Forests accuracy

Create Maximizing
hyperplane for margin between Classification
Both classification or classes or and Regression
predict predicting tasks
SVM continuous values continuous values

Finding k closest
Classification
Predict class or neighbors and
and Regression
Both value based on k predicting based
tasks, sensitive
closest neighbors on majority or
to noisy data
KNN average

Classification
Combine weak Iteratively and Regression
Both learners to create correcting errors tasks to improve
Gradient strong model with new models prediction
Boosting accuracy

Predict class Bayes' theorem


based on feature with feature Text
Classification classification,
Naive independence independence
Bayes assumption assumption spam filtering,
Regression,
Algorithm Classification Purpose Method Use Cases

sentiment
analysis, medical

These types of supervised learning in machine learning vary based on the problem we're
trying to solve and the dataset we're working with. In classification problems, the task is to
assign inputs to predefined classes, while regression problems involve predicting numerical
outcomes.

Practical Examples of Supervised learning


Few practical examples of supervised machine learning across various industries:

• Fraud Detection in Banking: Utilizes supervised learning algorithms on historical


transaction data, training models with labeled datasets of legitimate and fraudulent
transactions to accurately predict fraud patterns.

• Parkinson Disease Prediction: Parkinson’s disease is a progressive disorder that


affects the nervous system and the parts of the body controlled by the nerves.

• Customer Churn Prediction: Uses supervised learning techniques to analyze


historical customer data, identifying features associated with churn rates to predict
customer retention effectively.

• Cancer cell classification: Implements supervised learning for cancer cells based on
their features and identifying them if they are ‘malignant’ or ‘benign.

• Stock Price Prediction: Applies supervised learning to predict a signal that indicates
whether buying a particular stock will be helpful or not.

Advantages
Here are some advantages of supervised learning listed below:

• Simplicity & clarity: Easy to understand and implement since it learns from labeled
examples.

• High accuracy: When sufficient labeled data is available, models achieve strong
predictive performance.

• Versatility: Works for both classification like spam detection, disease prediction and
regression like price forecasting.
• Generalization: With enough diverse data and proper training, models can generalize
well to unseen inputs.

• Wide application: Used in speech recognition, medical diagnosis, sentiment analysis,


fraud detection and more.

Disadvantages
• Requires labeled data: Large amounts of labeled datasets are expensive and time-
consuming to prepare.

• Bias from data: If training data is biased or unbalanced, the model may learn and
amplify those biases.

• Overfitting risk: Model may memorize training data instead of learning general
patterns, especially with small datasets.

• Limited adaptability: Performance drops significantly when applied to data


distributions very different from training data.

• Not scalable for some problems: In tasks with millions of possible labels like natural
language, supervised labeling becomes impractical.
Decision Tree in Machine Learning
A decision tree is a supervised learning algorithm used for both classification and
regression tasks. It has a hierarchical tree structure which consists of a root node,
branches, internal nodes and leaf nodes. It works like a flowchart help to make decisions
step by step where:

 Internal nodes represent attribute tests


 Branches represent attribute values
 Leaf nodes represent final decisions or predictions.

Decision trees are widely used due to their interpretability, flexibility and low
preprocessing needs.

How Does a Decision Tree Work


A decision tree splits the dataset based on feature values to create pure subsets ideally all
items in a group belong to the same class. Each leaf node of the tree corresponds to a
class label and the internal nodes are feature-based decision points. Let’s understand this
with an example.

Let’s consider a decision tree for predicting whether a customer will buy a product based
on age, income and previous purchases: Here's how the decision tree works:

1. Root Node (Income)


First Question: "Is the person’s income greater than $50,000?"
 If Yes, proceed to the next question.
 If No, predict "No Purchase" (leaf node).

2. Internal Node (Age):


If the person’s income is greater than $50,000, ask: "Is the person’s age above 30?"
 If Yes, proceed to the next question.
 If No, predict "No Purchase" (leaf node).

3. Internal Node (Previous Purchases):


 If the person is above 30 and has made previous purchases, predict "Purchase" (leaf
node).
 If the person is above 30 and has not made previous purchases, predict "No Purchase"
(leaf node).

Information Gain and Gini Index in Decision Tree


Till now we have discovered the basic intuition and approach of how decision tree works,
so lets just move to the attribute selection measure of decision tree. We have two popular
attribute selection measures used:

1. Information Gain
Information Gain tells us how useful a question (or feature) is for splitting data into
groups. It measures how much the uncertainty decreases after the split. A good question
will create clearer groups and the feature with the highest Information Gain is chosen to
make the decision.

For example if we split a dataset of people into "Young" and "Old" based on age and all
young people bought the product while all old people did not, the Information Gain would
be high because the split perfectly separates the two groups with no uncertainty left

 Suppose S is a set of instances A is an attribute, Sv is the subset of S, v represents


an individual value that the attribute A can take and Values (A) is the set of all
possible values of A then

 Entropy: is the measure of uncertainty of a random variable it characterizes the


impurity of an arbitrary collection of examples. The higher the entropy more the
information content.

For example if a dataset has an equal number of "Yes" and "No" outcomes (like 3 people
who bought a product and 3 who didn’t), the entropy is high because it’s uncertain which
outcome to predict. But if all the outcomes are the same (all "Yes" or all "No") the entropy
is 0 meaning there is no uncertainty left in predicting the outcome.

Suppose S is a set of instances, A is an attribute, Sv is the subset of S with A= v and Values


(A) is the set of all possible values of A, then
Building Decision Tree using Information Gain the essentials
 Start with all training instances associated with the root node
 Use info gain to choose which attribute to label each node with
 Recursively construct each subtree on the subset of training instances that would
be classified down that path in the tree.
 If all positive or all negative training instances remain, the label that node “yes" or
“no" accordingly
 If no attributes remain label with a majority vote of training instances left at that
node
 If no instances remain label with a majority vote of the parent's training instances.

2. Gini Index
Gini Index is a metric to measure how often a randomly chosen element would be
incorrectly identified. It means an attribute with a lower Gini index should be preferred.
Sklearn supports “Gini” criteria for Gini Index and by default it takes “gini” value.
For example if we have a group of people where all bought the product (100% "Yes") the
Gini Index is 0 indicate perfect purity. But if the group has an equal mix of "Yes" and "No"
the Gini Index would be 0.5 show high impurity or uncertainty. Formula for Gini Index is
given by :

Some additional features of the Gini Index are:


1. It is calculated by summing the squared probabilities of each outcome in a
distribution and subtracting the result from 1.
2. A lower Gini Index indicates a more homogeneous or pure distribution while a
higher Gini Index indicates a more heterogeneous or impure distribution.
3. In decision trees the Gini Index is used to evaluate the quality of a split by
measuring the difference between the impurity of the parent node and the
weighted impurity of the child nodes.
4. Compared to other impurity measures like entropy, the Gini Index is faster to
compute and more sensitive to changes in class probabilities.
5. One disadvantage of the Gini Index is that it tends to favour splits that create
equally sized child nodes, even if they are not optimal for classification accuracy.
6. In practice the choice between using the Gini Index or other impurity measures
depends on the specific problem and dataset and requires experimentation and
tuning.

Understanding Decision Tree with Real life use case:


Till now we have understand about the attributes and components of decision tree. Now
lets jump to a real life use case in which how decision tree works step by step.

Step 1. Start with the Whole Dataset


We begin with all the data which is treated as the root node of the decision tree.

Step 2. Choose the Best Question (Attribute)


Pick the best question to divide the dataset. For example ask: "What is the outlook?"
Possible answers: Sunny, Cloudy or Rainy.

Step 3. Split the Data into Subsets


Divide the dataset into groups based on the question:
 If Sunny go to one subset.
 If Cloudy go to another subset.
 If Rainy go to the last subset.

Step 4. Split Further if Needed (Recursive Splitting)


For each subset ask another question to refine the groups. For example If the Sunny
subset is mixed ask: "Is the humidity high or normal?"
 High humidity → "Swimming".
 Normal humidity → "Hiking".

Step 5. Assign Final Decisions (Leaf Nodes)


When a subset contains only one activity, stop splitting and assign it a label:
 Cloudy → "Hiking".
 Rainy → "Stay Inside".
 Sunny + High Humidity → "Swimming".
 Sunny + Normal Humidity → "Hiking".

Step 6. Use the Tree for Predictions


To predict an activity follow the branches of the tree. Example: If the outlook is Sunny and
the humidity is High follow the tree:
 Start at Outlook.
 Take the branch for Sunny.
 Then go to Humidity and take the branch for High Humidity.
 Result: "Swimming".
A decision tree works by breaking down data step by step asking the best possible
questions at each point and stopping once it reaches a clear decision. It's an easy and
understandable way to make choices. Because of their simple and clear structure decision
trees are very helpful in machine learning for tasks like sorting data into categories or
making predictions.
Logistic Regression
Logistic regression is a data analysis technique that uses mathematics to find the
relationships between two data factors. It then uses this relationship to predict the value of
one of those factors based on the other. The prediction usually has a finite number of
outcomes, like yes or no.
For example, let’s say you want to guess if your website visitor will click the checkout button
in their shopping cart or not. Logistic regression analysis looks at past visitor behavior, such
as time spent on the website and the number of items in the cart. It determines that, in the
past, if visitors spent more than five minutes on the site and added more than three items
to the cart, they clicked the checkout button. Using this information, the logistic regression
function can then predict the behavior of a new website visitor.

Types of Logistic Regression


Logistic regression can be classified into three main types based on the nature of the
dependent variable:

1. Binomial Logistic Regression: This type is used when the dependent variable has only
two possible categories. Examples include Yes/No, Pass/Fail or 0/1. It is the most
common form of logistic regression and is used for binary classification problems.

2. Multinomial Logistic Regression: This is used when the dependent variable has three or
more possible categories that are not ordered. For example, classifying animals into
categories like "cat," "dog" or "sheep." It extends the binary logistic regression to
handle multiple classes.

3. Ordinal Logistic Regression: This type applies when the dependent variable has three
or more categories with a natural order or ranking. Examples include ratings like "low,"
"medium" and "high." It takes the order of the categories into account when modeling.

How does regression analysis work?


Logistic regression is one of several different regression analysis techniques that data
scientists commonly use in machine learning (ML). To understand logistic regression, we
must first understand basic regression analysis. Below, we use an example of linear
regression analysis to demonstrate how regression analysis works.

1. Identify the question


Any data analysis begins with a business question. For logistic regression, you should frame
the question to get particular outcomes:

 Do rainy days impact our monthly sales? (yes or no)


 What type of credit card activity is the customer performing? (authorized, fraudulent, or
potentially fraudulent)
2. Collect historical data
After identifying the question, you need to identify the data factors that are involved. You
will then collect past data for all factors. For example, to answer the first question shown
above, you could collect the number of rainy days and your monthly sales data for each
month in the past three years.

3. Train the regression analysis model


You will process the historical data using regression software. The software will process the
different data points and connect them mathematically by using equations. For example, if
the number of rainy days for three months are 3, 5, and 8 and the number of sales in those
months are 8, 12, and 18, the regression algorithm will connect the factors with the
equation:
Number of Sales = 2*(Number of Rainy Days) + 2

4. Make predictions for unknown values


For unknown values, the software uses the equation to make a prediction. If you know that
it will rain for six days in July, the software will estimate July’s sale value as 14.

Understanding Sigmoid Function


1. The sigmoid function is a important part of logistic regression which is used to
convert the raw output of the model into a probability value between 0 and 1.

2. This function takes any real number and maps it into the range 0 to 1 forming an
"S" shaped curve called the sigmoid curve or logistic curve. Because probabilities
must lie between 0 and 1, the sigmoid function is perfect for this purpose.

3. In logistic regression, we use a threshold value usually 0.5 to decide the class label.
 If the sigmoid output is same or above the threshold, the input is classified
as Class 1.
 If it is below the threshold, the input is classified as Class 0.

This approach helps to transform continuous input values into meaningful class
predictions.

How does Logistic Regression work?


Logistic regression model transforms the linear regression function continuous value
output into categorical value output using a sigmoid function which maps any real-valued
set of independent variables input into a value between 0 and 1. This function is known as
the logistic function.
Terminologies involved in Logistic Regression
Here are some common terms involved in logistic regression:

1. Independent Variables: These are the input features or predictor variables used to
make predictions about the dependent variable.

2. Dependent Variable: This is the target variable that we aim to predict. In logistic
regression, the dependent variable is categorical.

3. Logistic Function: This function transforms the independent variables into a probability
between 0 and 1 which represents the likelihood that the dependent variable is either 0
or 1.

4. Odds: This is the ratio of the probability of an event happening to the probability of it
not happening. It differs from probability because probability is the ratio of occurrences
to total possibilities.

5. Log-Odds (Logit): The natural logarithm of the odds. In logistic regression, the log-odds
are modeled as a linear combination of the independent variables and the intercept.

6. Coefficient: These are the parameters estimated by the logistic regression model which
shows how strongly the independent variables affect the dependent variable.

7. Intercept: The constant term in the logistic regression model which represents the log-
odds when all independent variables are equal to zero.

8. Maximum Likelihood Estimation (MLE): This method is used to estimate the


coefficients of the logistic regression model by maximizing the likelihood of observing
the given data.

Applications of logistic regression


Logistic regression has several real-world applications in many different industries.

 Manufacturing

Manufacturing companies use logistic regression analysis to estimate the probability of part
failure in machinery. They then plan maintenance schedules based on this estimate to
minimize future failures.

 Healthcare

Medical researchers plan preventive care and treatment by predicting the likelihood of
disease in patients. They use logistic regression models to compare the impact of family
history or genes on diseases.
 Finance

Financial companies have to analyze financial transactions for fraud and assess loan
applications and insurance applications for risk. These problems are suitable for a logistic
regression model because they have discrete outcomes, like high risk or low risk and
fraudulent or not fraudulent.

 Marketing

Online advertising tools use the logistic regression model to predict if users will click on an
advertisement. As a result, marketers can analyze user responses to different words and
images and create high-performing advertisements with which customers will engage.

Differences Between Linear and Logistic Regression

Aspect Linear Regression Logistic Regression

Linear regression is used to predict Logistic regression is used to


the continuous dependent predict the categorical dependent
variable using a given set of variable using a given set of
Definition independent variables. independent variables.

It is used for solving regression It is used for solving classification


Problem Type problem. problems.

In this we predict the value of In this we predict values of


Output Type continuous variables. categorical variables.

Curve/Model
In this we find best fit line. In this we find S-Curve.
Fitting

Maximum likelihood estimation


Least square estimation method is
Estimation method is used for estimation of
used for estimation of accuracy.
Method accuracy.

Output The output must be continuous Output must be categorical value


Example value such as price, age etc. such as 0 or 1, Yes or No, etc.

It required linear relationship


Relationship between dependent and It not required linear relationship.
Requirement independent variables.

There may be collinearity between There should be little to no collinearity


Collinearity the independent variables. between independent variables.
Linear Regression
Linear regression is a type of supervised machine-learning algorithm that learns from the
labelled datasets and maps the data points with most optimized linear functions which
can be used for prediction on new datasets. It assumes that there is a linear relationship
between the input and output, meaning the output changes at a constant rate as the input
changes. This relationship is represented by a straight line.

For example we want to predict a student's exam score based on how many hours they
studied. We observe that as students study more hours, their scores go up. In the example
of predicting exam scores based on hours studied. Here
 Independent variable (input): Hours studied because it's the factor we control or
observe.
 Dependent variable (output): Exam score because it depends on hobw many hours
were studied.

We use the independent variable to predict the dependent variable.

Best Fit Line in Linear Regression


In linear regression, the best-fit line is the straight line that most accurately represents the
relationship between the independent variable (input) and the dependent variable
(output). It is the line that minimizes the difference between the actual data points and
the predicted values from the model.

1. Goal of the Best-Fit Line


The goal of linear regression is to find a straight line that minimizes the error (the
difference) between the observed data points and the predicted values. This line helps us
predict the dependent variable for new, unseen data.
Here Y is called a dependent or target variable and X is called an independent variable also
known as the predictor of Y. There are many types of functions or modules that can be
used for regression. A linear function is the simplest type of function. Here, X may be a
single feature or multiple features representing the problem.

2. Equation of the Best-Fit Line


For simple linear regression (with one independent variable), the best-fit line is
represented by the equation

Where:
 y is the predicted value (dependent variable)
 x is the input (independent variable)
 m is the slope of the line (how much y changes when x changes)
 b is the intercept (the value of y when x = 0)
The best-fit line will be the one that optimizes the values of m (slope) and b (intercept) so
that the predicted y values are as close as possible to the actual data points.

3. Minimizing the Error: The Least Squares Method


To find the best-fit line, we use a method called Least Squares. The idea behind this
method is to minimize the sum of squared differences between the actual values (data
points) and the predicted values from the line. These differences are called residuals.
The formula for residuals is:

This method ensures that the line best represents the data where the sum of the squared
differences between the predicted values and actual values is as small as possible.

4. Interpretation of the Best-Fit Line


 Slope (m): The slope of the best-fit line indicates how much the dependent
variable (y) changes with each unit change in the independent variable (x). For
example if the slope is 5, it means that for every 1-unit increase in x, the value of y
increases by 5 units.
 Intercept (b): The intercept represents the predicted value of y when x = 0. It’s the
point where the line crosses the y-axis.
In linear regression some hypothesis are made to ensure reliability of the model's results.

Limitations
 Assumes Linearity: The method assumes the relationship between the variables is
linear. If the relationship is non-linear, linear regression might not work well.
 Sensitivity to Outliers: Outliers can significantly affect the slope and intercept,
skewing(suddenly change direction or position) the best-fit line.

Assumptions of the Linear Regression


1. Linearity: The relationship between inputs (X) and the output (Y) is a straight line.

2. Independence of Errors: The errors in predictions should not affect each other.

3. Constant Variance (Homoscedasticity): The errors should have equal spread across all
values of the input. If the spread changes (like fans out or shrinks), it's called
heteroscedasticity and it's a problem for the model.

4. Normality of Errors: The errors should follow a normal (bell-shaped) distribution.

5. No Multicollinearity(for multiple regression): Input variables shouldn’t be too closely


related to each other.

6. No Autocorrelation: Errors shouldn't show repeating patterns, especially in time-based


data.

7. Additivity: The total effect on Y is just the sum of effects from each X, no mixing or
interaction between them.

Types of Linear Regression


1. Simple Linear Regression
Simple linear regression is used when we want to predict a target value (dependent
variable) using only one input feature (independent variable). It assumes a straight-line
relationship between the two.

2. Multiple Linear Regression


Multiple linear regression involves more than one independent variable and one
dependent variable. The equation for multiple linear regression is:

Use Cases
 Real Estate: Predict property prices using location, size and other factors.
 Finance: Forecast stock prices using interest rates and inflation data.
 Agriculture: Estimate crop yield from rainfall, temperature and soil quality.
 E-commerce: Analyze how price, promotions and seasons affect sales.

Cost function for Linear Regression


In Linear Regression, the cost function measures how far the predicted values are from
the actual values (Y). It helps identify and reduce errors to find the best-fit line. The most
common cost function used is Mean Squared Error (MSE), which calculates the average of
squared differences between actual and predicted values.

Evaluation Metrics for Linear Regression

A variety of evaluation measures can be used to determine the strength of any linear
regression model. These assessment metrics often give an indication of how well the
model is producing the observed outputs.
The most common measurements are:

1. Mean Square Error (MSE)


Mean Squared Error (MSE) is an evaluation metric that calculates the average of the
squared differences between the actual and predicted values for all the data points. The
difference is squared to ensure that negative and positive differences don't cancel each
other out.

2. Mean Absolute Error (MAE)


Mean Absolute Error is an evaluation metric used to calculate the accuracy of a regression
model. MAE measures the average absolute difference between the predicted values and
actual values.
Lower MAE value indicates better model performance. It is not sensitive to the outliers as
we consider absolute differences.
3. Root Mean Squared Error (RMSE)
The square root of the residuals' variance is the Root Mean Squared Error. It describes
how well the observed data points match the expected values or the model's absolute fit
to the data. RMSE is in the same unit as the target variable and highlights larger errors
more clearly.

4. Coefficient of Determination (R-squared)


R-Squared is a statistic that indicates how much variation the developed model can
explain or capture. It is always in the range of 0 to 1. In general, the better the model
matches the data, the greater the R-squared number.

 Residual sum of Squares(RSS): The sum of squares of the residual for each data
point in the plot or data is known as the residual sum of squares or RSS. It is a
measurement of the difference between the output that was observed and what
was anticipated.
 Total Sum of Squares (TSS): The sum of the data points' errors from the answer
variable's mean is known as the total sum of squares or TSS.

R squared metric is a measure of the proportion of variance in the dependent variable that
is explained the independent variables in the model.

Why Linear Regression is Important


Here’s why linear regression is important:
 Simplicity and Interpretability: It’s easy to understand and interpret, making it a
starting point for learning about machine learning.
 Predictive Ability: Helps predict future outcomes based on past data, making it
useful in various fields like finance, healthcare and marketing.
 Basis for Other Models: Many advanced algorithms, like logistic regression or
neural networks, build on the concepts of linear regression.
 Efficiency: It’s computationally efficient and works well for problems with a linear
relationship.
 Widely Used: It’s one of the most widely used techniques in both statistics and
machine learning for regression tasks.
 Analysis: It provides insights into relationships between variables (e.g., how much
one variable influences another).

Advantages
 Linear regression is a relatively simple algorithm, making it easy to understand and
implement. The coefficients of the linear regression model can be interpreted as the
change in the dependent variable for a one-unit change in the independent variable,
providing insights into the relationships between variables.
 Linear regression is computationally efficient and can handle large datasets effectively.
It can be trained quickly on large datasets, making it suitable for real-time applications.
 Linear regression is relatively robust to outliers compared to other machine learning
algorithms. Outliers may have a smaller impact on the overall model performance.
 Linear regression often serves as a good baseline model for comparison with more
complex machine learning algorithms.
 Linear regression is a well-established algorithm with a rich history and is widely
available in various machine learning libraries and software packages.

Limitations
 Linear regression assumes a linear relationship between the dependent and
independent variables. If the relationship is not linear, the model may not perform
well.
 Linear regression is sensitive to multicollinearity, which occurs when there is a high
correlation between independent variables. Multicollinearity can inflate the variance
of the coefficients and lead to unstable model predictions.
 Linear regression assumes that the features are already in a suitable form for the
model. Feature engineering may be required to transform features into a format that
can be effectively used by the model.
 Linear regression is susceptible to both overfitting and underfitting. Overfitting occurs
when the model learns the training data too well and fails to generalize to unseen
data. Underfitting occurs when the model is too simple to capture the underlying
relationships in the data.
 Linear regression provides limited explanatory power for complex relationships
between variables. More advanced machine learning techniques may be necessary for
deeper insights.
Neural Network
Neural networks are machine learning models that mimic the complex functions of the
human brain. These models consist of interconnected nodes or neurons that process data,
learn patterns and enable tasks such as pattern recognition and decision-making.

Neural networks are capable of learning and identifying patterns directly from data
without pre-defined rules. These networks are built from several key components:

 Neurons: The basic units that receive inputs, each neuron is governed by a
threshold and an activation function.
 Connections: Links between neurons that carry information, regulated by weights
and biases.
 Weights and Biases: These parameters determine the strength and influence of
connections.
 Propagation Functions: Mechanisms that help process and transfer data across
layers of neurons.
 Learning Rule: The method that adjusts weights and biases over time to improve
accuracy.
Learning in neural networks follows a structured, three-stage
process:

1. Input Computation: Data is fed into the network.

2. Output Generation: Based on the current parameters, the network generates an


output.

3. Iterative Refinement: The network refines its output by adjusting weights and
biases, gradually improving its performance on diverse tasks.

Working of Neural Networks


1. Forward Propagation
When data is input into the network, it passes through the network in the forward
direction, from the input layer through the hidden layers to the output layer. This
process is known as forward propagation. Here’s what happens during this phase:

1. Linear Transformation: Each neuron in a layer receives inputs which are


multiplied by the weights associated with the connections. These
products are summed together and a bias is added to the sum. This can
be represented mathematically as:

where
 w represents the weights
 x represents the inputs
 b is the bias

2. Activation: The result of the linear transformation (denoted as z) is then


passed through an activation function. The activation function is crucial
because it introduces non-linearity into the system, enabling the
network to learn more complex patterns. Popular activation functions
include ReLU, sigmoid and tanh.

2. Backpropagation
After forward propagation, the network evaluates its performance using a loss
function which measures the difference between the actual output and the
predicted output. The goal of training is to minimize this loss. This is where
backpropagation comes into play:
 Loss Calculation: The network calculates the loss which provides a measure of
error in the predictions. The loss function could vary; common choices are mean
squared error for regression tasks or cross-entropy loss for classification.
 Gradient Calculation: The network computes the gradients of the loss function
with respect to each weight and bias in the network. This involves applying the
chain rule of calculus to find out how much each part of the output error can be
attributed to each weight and bias.
 Weight Update: Once the gradients are calculated, the weights and biases are
updated using an optimization algorithm like stochastic gradient descent (SGD).
The weights are adjusted in the opposite direction of the gradient to minimize the
loss. The size of the step taken in each update is determined by the learning rate.

3. Iteration
This process of forward propagation, loss calculation, backpropagation and weight
update is repeated for many iterations over the dataset. Over time, this iterative
process reduces the loss and the network's predictions become more accurate.
Through these steps, neural networks can adapt their parameters to better
approximate the relationships in the data, thereby improving their performance on
tasks such as classification, regression or any other predictive modeling.

Activation functions in Neural Networks


An activation function in a neural network is a mathematical function applied to the
output of a neuron. It introduces non-linearity, enabling the model to learn and represent
complex data patterns. Without it, even a deep neural network would behave like a simple
linear regression model.
Activation functions decide whether a neuron should be activated based on the weighted
sum of inputs and a bias term. They also make backpropagation possible by providing
gradients for weight updates.

Why Non-Linearity is Important


 Real-world data is rarely linearly separable.
 Non-linear functions allow neural networks to form curved decision boundaries,
making them capable of handling complex patterns (e.g., classifying apples vs.
bananas under varying colors and shapes).
 They ensure networks can model advanced problems like image recognition, NLP
and speech processing.

Mathematical Example
Consider a neural network with:
 Inputs: i1, i2
 Hidden layer: neurons h1 and h2
 Output layer: one neuron (output)
 Weights: w1, w2, w3, w4, w5, w6
 Biases: b1 for hidden layer, b2 for output layer
This gives the final output of the network after applying the sigmoid activation
function in output layers, introducing the desired non-linearity.

Types of Activation Functions in Deep Learning


1. Linear Activation Function
Linear Activation Function resembles straight line define by y=x. No matter how many
layers the neural network contains if they all use linear activation functions the output is a
linear combination of the input.
 The range of the output spans from (−∞ to +∞)(−∞ to +∞).
 Linear activation function is used at just one place i.e. output layer.
 Using linear activation across all layers makes the network's ability to learn
complex patterns limited.
Linear activation functions are useful for specific tasks but must be combined with non-
linear functions to enhance the neural network’s learning and predictive capabilities.

2. Non-Linear Activation Functions


2. Tanh Activation Function

Tanh function (hyperbolic tangent function) is a shifted version


of the sigmoid, allowing it to stretch across the y-axis. It is
defined as:
Importance of Neural Networks
 Identify Complex Patterns: Recognize intricate structures and relationships in
data; adapt to dynamic and changing environments.
 Learn from Data: Handle vast datasets efficiently; improve performance with
experience and retraining.
 Drive Key Technologies: Power natural language processing (NLP); enable self-
driving vehicles; support automated decision-making systems.
 Boost Efficiency: Streamline workflows and processes; enhance productivity across
industries.
 Backbone of AI: Serve as the core driver of artificial intelligence progress; continue
shaping the future of technology and innovation.
Layers in Neural Network Architecture

1. Input Layer: This is where the network receives its input data. Each input neuron in
the layer corresponds to a feature in the input data.
2. Hidden Layers: These layers perform most of the computational heavy lifting. A
neural network can have one or multiple hidden layers. Each layer consists of units
(neurons) that transform the inputs into something that the output layer can use.
3. Output Layer: The final layer produces the output of the model. The format of
these outputs varies depending on the specific task like classification, regression.

Learning of a Neural Network


1. Learning with Supervised Learning
In supervised learning, a neural network learns from labeled input-output pairs
provided by a teacher. The network generates outputs based on inputs and by
comparing these outputs to the known desired outputs, an error signal is created.
The network iteratively adjusts its parameters to minimize errors until it reaches an
acceptable performance level.

2. Learning with Unsupervised Learning


Unsupervised learning involves data without labeled output variables. The primary
goal is to understand the underlying structure of the input data (X). Unlike
supervised learning, there is no instructor to guide the process. Instead, the focus
is on modeling data patterns and relationships, with techniques like clustering and
association commonly used.

3. Learning with Reinforcement Learning


Reinforcement learning enables a neural network to learn through interaction with
its environment. The network receives feedback in the form of rewards or
penalties, guiding it to find an optimal policy or strategy that maximizes cumulative
rewards over time. This approach is widely used in applications like gaming and
decision-making.

Types of Neural Networks


1. Feedforward Neural Networks
Feedforward neural networks are a form of artificial neural network where without
forming any cycles between layers or nodes means inputs can pass data through those
nodes within the hidden level to the output nodes.

 Architecture: Made up of layers with unidirectional flow of data i.e., from input
through hidden and the output layer.
 Training: Backpropagation is often used during training for the main aim of
reducing the prediction errors.
 Applications: In visual and voice recognition, NLP, financial forecasting and
recommending system
 When to use: Best for general-purpose tasks like classification and regression. Ideal
when data is static and has no sequential dependencies.

2. Convolutional Neural Networks (CNNs)


Convolutional neural networks structure is focused on processing the grid type data like
images and videos by using convolutional layers filtering driving the patterns and spatial
hierarchies.

 Key Components: Utilizing convolutional layers, pooling layers and fully connected
layers.
 Applications: Used for classification of images, object detection, medical imaging
analyzes, autonomous driving and visualization in augmented reality.
 When to use: Use when working with image, video or grid-structured data.

3. Recurrent Neural Networks (RNNs)


Recurrent neural network handles sequential data in which the current output is a result
of previous inputs by looping over themselves to hold internal state (memory).

 Architecture: Contains recurrent connections that enable feedback loops for


processing sequences.
 Challenges: Problems such as vanishing gradients become apparent since they limit
capturing interdependence on a long scale.
 Applications: Language translation, open-ended text classification, ones to ones
interaction and time series prediction are its applications.
 When to use: Use for tasks involving sequences like text, speech or time series.

4. Long Short-Term Memory Networks (LSTMs)


Long Short-Term Memory Networks (LSTMs) are a variant of RNNs. They exhibit memory
cells to solve the disappearing gradient issue and keep large ranges of information in their
memory.
 Key Features: Capture memory cells in pass information flowing and graduate
greediness issue.
 Applications: Value of RNNs is in terms of importing long-term memory into the
model like language translation and time-series forecasting.
 When to use: Use when you need to model long-term dependencies in sequences.

Advantages
Neural networks are widely used in many different applications because of their many
benefits:
 Adaptability: Neural networks are useful for activities where the link between
inputs and outputs is complex or not well defined because they can adapt to new
situations and learn from data.
 Pattern Recognition: Their proficiency in pattern recognition renders them
efficacious in tasks like as audio and image identification, natural language
processing and other intricate data patterns.
 Parallel Processing: Because neural networks are capable of parallel processing by
nature, they can process numerous jobs at once which speeds up and improves the
efficiency of computations.
 Non-Linearity: Neural networks are able to model and comprehend complicated
relationships in data by virtue of the non-linear activation functions found in
neurons which overcome the drawbacks of linear models.

Limitations
Neural networks while powerful, are not without drawbacks and difficulties:
 Computational Intensity: Large neural network training can be a laborious and
computationally demanding process that demands a lot of computing power.
 Black box Nature: As "black box" models, neural networks pose a problem in
important applications since it is difficult to understand how they make decisions.
 Overfitting: Overfitting is a phenomenon in which neural networks commit training
material to memory rather than identifying patterns in the data. Although
regularization approaches help to alleviate this, the problem still exists.
 Need for Large datasets: For efficient training, neural networks frequently need
sizable, labeled datasets; otherwise, their performance may suffer from incomplete
or skewed data.

Applications
Neural networks have numerous applications across various fields:
1. Image and Video Recognition: CNNs are extensively used in applications such as
facial recognition, autonomous driving and medical image analysis.
2. Natural Language Processing (NLP): RNNs and transformers power language
translation, chatbots and sentiment analysis.
3. Finance: Predicting stock prices, fraud detection and risk management.
4. Healthcare: Neural networks assist in diagnosing diseases, analyzing medical
images and personalizing treatment plans.
5. Gaming and Autonomous Systems: Neural networks enable real-time decision-
making, enhancing user experience in video games and enabling autonomous
systems like self-driving cars.
Regularization in Machine Learning

Regularization is a technique used in machine learning to prevent overfitting, which occurs


when a model learns the training data too well, including its noise and outliers, and performs
poorly on new, unseen data. Regularization helps create models that generalize better to
new data by adding a penalty to the loss function (the function the model tries to minimize
during training), which keeps the model’s parameters (like weights in a neural network)
smaller and simpler.

How Is Regularization Used?


Regularization is implemented by modifying the loss function. In a typical machine learning

model, the loss function measures how well the model’s predictions match the actual data.

Regularization adds an extra term to this loss function that penalizes large weights.

Loss = Original Loss + λ × Regularization Term

 Original Loss: Measures the difference between the model’s predictions and the

actual values.

 Regularization Term: Adds a penalty for larger weights.

 λ (lambda): A hyperparameter that controls the strength of the penalty. A larger λ

means more regularization.


By minimizing this new loss function, the model not only fits the data but also keeps the

weights small, which helps in generalizing better to new data.

Types of Regularization: L1 and L2


The most common types of regularization are L1 regularization and L2 regularization. They

differ in how they penalize the model’s weights.

L1 Regularization (Lasso (Least Absolute Shrinkage and


Selection Operator)) Regression)
It adds the absolute value of the weights to the loss function.

Loss = Original Loss + λ ∑ᵢ |Wᵢ|

Imagine we have a dataset with many features (variables), but not all of them are important

for predicting the output. Using L1 regularization can help the model focus on the most

significant features by reducing the weights of less important ones to zero.

L2 Regularization (Ridge Regression)


It adds the square of the weights to the loss function.

Loss = Original Loss + λ ∑ᵢ Wᵢ²

Suppose we’re building a model to predict house prices based on various features like size,

number of rooms, age, location, etc. L2 regularization helps ensure that the model doesn’t

assign too much importance to any one feature and considers all of them in a balanced way.

Example: House Price Prediction


Scenario: Imagine we’re building a model to predict the price of a house based on various
features like:
 Size of the house (square feet)

 Number of bedrooms

 Location (urban, suburban, rural)

 Age of the house

 Presence of a swimming pool, garage, etc.

Without regularization, our model might give too much importance to some features, like

the presence of a swimming pool or the age of the house, even if those features don’t

significantly influence the price. This could lead to overfitting, especially if the training data

contains houses with unusual characteristics (outliers). For example, maybe one very

expensive house has a large swimming pool, and the model might learn that “swimming

pools” lead to a high price, which isn’t true in general.

How Regularization Helps:


 L1 Regularization (Lasso): Can reduce the influence of less important features, such

as whether the house has a garage, by shrinking their corresponding weights to zero.

This makes the model simpler and helps focus on the most important factors (like

size and location).

 L2 Regularization (Ridge): Ensures that all features contribute in a balanced way to

the price prediction, preventing any one feature from dominating the prediction.

Benefits of Regularization
Now, let’s see various benefits of regularization which are as follows:

 Prevents Overfitting: Regularization helps models focus on underlying patterns


instead of memorizing noise in the training data.
 Enhances Performance: Prevents excessive weighting of outliers or irrelevant
features helps in improving overall model accuracy.
 Stabilizes Models: Reduces sensitivity to minor data changes which ensures
consistency across different data subsets.
 Prevents Complexity: Keeps model from becoming too complex which is important
for limited or noisy data.
 Handles Multicollinearity: Reduces the magnitudes of correlated coefficients helps
in improving model stability.
 Promotes Consistency: Ensures reliable performance across different datasets
which reduces the risk of large performance shifts.
Unsupervised Learning
Unsupervised Learning is a type of machine learning where the model works without
labelled data. It learns patterns on its own by grouping similar data points or finding
hidden structures without any human intervention.

 It is used for tasks like clustering, dimensionality reduction and Association Rule
Learning.

 Helps identify hidden patterns in data

 Useful for grouping, compression and anomaly detection

The image shows set of animals like 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.

 An algorithm represents unsupervised learning process that helps to identify patterns


in the data.

 The 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).
Working of Unsupervised Learning
The working of unsupervised machine learning can be explained in these steps:

1. Collect Unlabeled Data

 Gather a dataset without predefined labels or categories.


 Example: Images of various animals without any tags.

2. Select an Algorithm
 Choose a suitable unsupervised algorithm such as clustering like K-Means,
association rule learning like Apriori or dimensionality reduction like PCA based
on the goal.

3. Train the Model on Raw Data

 Feed the entire unlabeled dataset to the algorithm.


 The algorithm looks for similarities, relationships or hidden structures within
the data.

4. Group or Transform Data

 The algorithm organizes data into groups (clusters), rules or lower-dimensional


forms without human input.
 Example: It may group similar animals together or extract key patterns from
large datasets.

5. Interpret and Use Results

 Analyze the discovered groups, rules or features to gain insights or use them
for further tasks like visualization, anomaly detection or as input for other
models.

Unsupervised Learning Algorithms


There are mainly 3 types of Unsupervised Algorithms that are used:

1. Clustering Algorithms
Clustering is an unsupervised machine learning technique that groups unlabeled data into
clusters based on similarity. Its goal is to discover patterns or relationships within the data
without any prior knowledge of categories or labels.

 Groups data points that share similar features or characteristics.


 Helps find natural groupings in raw, unclassified data.
 Commonly used for customer segmentation, anomaly detection and data
organization.
 Works purely from the input data without any output labels.
 Enables understanding of data structure for further analysis or decision-making.

Some common clustering algorithms:

 K-means Clustering: Groups data into K clusters based on how close the points are
to each other.
 Hierarchical Clustering: Creates clusters by building a tree step-by-step, either
merging or splitting groups.
 Density-Based Clustering (DBSCAN): Finds clusters in dense areas and treats
scattered points as noise.
 Mean-Shift Clustering: Discovers clusters by moving points toward the most
crowded areas.
 Spectral Clustering: Groups data by analyzing connections between points using
graphs.

2. Association Rule Learning


Association rule learning is a rule-based unsupervised learning technique used to discover
interesting relationships between variables in large datasets. It identifies patterns in the
form of “if-then” rules, showing how the presence of some items in the data implies the
presence of others.

 Finds frequent item combinations and the rules connecting them.


 Commonly used in market basket analysis to understand product purchase
relationships.
 Helps retailers design promotions and cross-selling strategies.

Some common Association Rule Learning algorithms:

 Apriori Algorithm: Finds patterns by exploring frequent item combinations step-


by-step.
 FP-Growth Algorithm: An Efficient Alternative to Apriori. It quickly identifies
frequent patterns without generating candidate sets.
 Eclat Algorithm: Uses intersections of itemsets to efficiently find frequent
patterns.
 Efficient Tree-based Algorithms: Scales to handle large datasets by organizing
data in tree structures.

3. Dimensionality Reduction
Dimensionality reduction is the process of decreasing the number of features or variables
in a dataset while retaining as much of the original information as possible. This technique
helps simplify complex data making it easier to analyze and visualize. It also improves the
efficiency and performance of machine learning algorithms by reducing noise and
computational cost.

 It reduces the dataset’s feature space from many dimensions to fewer, more
meaningful ones.
 Helps focus on the most important traits or patterns in the data.
 Commonly used to improve model speed and reduce overfitting.

Here are some popular Dimensionality Reduction algorithms:

 Principal Component Analysis (PCA): Reduces dimensions by transforming data


into uncorrelated principal components.
 Linear Discriminant Analysis (LDA): Reduces dimensions while maximizing class
separability for classification tasks.
 Non-negative Matrix Factorization (NMF): Breaks data into non-negative parts
to simplify representation.
 Locally Linear Embedding (LLE): Reduces dimensions while preserving the
relationships between nearby points.
 Isomap: Captures global data structure by preserving distances along a
manifold.

Applications of Unsupervised learning


Unsupervised learning has diverse applications across industries and domains. Key
applications include:

1. Customer Segmentation: Algorithms cluster customers based on purchasing


behavior or demographics, enabling targeted marketing strategies.
2. Anomaly Detection: Identifies unusual patterns in data, aiding fraud detection,
cybersecurity and equipment failure prevention.
3. Recommendation Systems: Suggests products, movies or music by analyzing user
behavior and preferences.
4. Image and Text Clustering: Groups similar images or documents for tasks like
organization, classification or content recommendation.
5. Social Network Analysis: Detects communities or trends in user interactions on
social media platforms.

Advantages
 No need for labeled data: Works with raw, unlabeled data hence saving time and
effort on data annotation.
 Discovers hidden patterns: Finds natural groupings and structures that might be
missed by humans.
 Handles complex and large datasets: Effective for high-dimensional or vast
amounts of data.
 Useful for anomaly detection: Can identify outliers and unusual data points
without prior examples.

Challenges
Here are the key challenges of unsupervised learning:

 Noisy Data: Outliers and noise can distort patterns and reduce the effectiveness of
algorithms.
 Overfitting Risk: Overfitting can occur when models capture noise instead of
meaningful patterns in the data.
 Limited Guidance: The absence of labels restricts the ability to guide the algorithm
toward specific outcomes.
 Cluster Interpretability: Results such as clusters may lack clear meaning or
alignment with real-world categories.
Clustering in Machine Learning
Clustering is an unsupervised machine learning technique that groups similar data points
together into clusters based on their characteristics, without using any labeled data. The
objective is to ensure that data points within the same cluster are more similar to each
other than to those in different clusters, enabling the discovery of natural groupings and
hidden patterns in complex datasets.
 Goal: Discover the natural grouping or structure in unlabeled data without
predefined categories.
 How: Data points are assigned to clusters based on similarity or distance measures.
 Similarity Measures: Can include Euclidean distance, cosine similarity or other
metrics depending on data type and clustering method.
 Output: Each group is assigned a cluster ID, representing shared
characteristics within the cluster.

For example, if we have customer purchase data, clustering can group customers with
similar shopping habits. These clusters can then be used for targeted marketing,
personalized recommendations or customer segmentation.

Types of Clustering
1. Hard Clustering: In hard clustering, each data point strictly belongs to exactly one
cluster, no overlap is allowed. This approach assigns a clear membership, making it easier
to interpret and use for definitive segmentation tasks.
 Example: If clustering customer data into 2 segments, each customer belongs fully
to either Cluster 1 or Cluster 2 without partial memberships.
 Use cases: Market segmentation, customer grouping, document clustering.
 Limitations: Cannot represent ambiguity or overlap between groups; boundaries
are crisp.

2. Soft Clustering: Soft clustering assigns each data point a probability or degree of
membership to multiple clusters simultaneously, allowing data points to partially belong
to several groups.
 Example: A data point may have a 70% membership in Cluster 1 and 30% in Cluster
2, reflecting uncertainty or overlap in group characteristics.
 Use cases: Situations with overlapping class boundaries, fuzzy categories like
customer personas or medical diagnosis.
 Benefits: Captures ambiguity in data, models gradual transitions between clusters.

Let's see an example to see the difference between the hard and soft clustering using a
distribution,

Data Point Hard Clustering Soft Clustering

A Cluster 1 Cluster 1: 0.91, Cluster 2: 0.09

B Cluster 2 Cluster 1: 0.30, Cluster 2: 0.70

C Cluster 3 Cluster 1: 0.17, Cluster 2: 0.83

D Cluster 4 Cluster 1: 1.00, Cluster 2: 0.00

Types of Clustering Methods


Clustering methods can be classified on the basis of how they form clusters,

1. Centroid-based Clustering (Partitioning Methods)


Centroid-based clustering organizes data points around central prototypes called
centroids, where each cluster is represented by the mean (or medoid) of its members. The
number of clusters is specified in advance and the algorithm allocates points to the
nearest centroid, making this technique efficient for spherical and similarly sized clusters
but sensitive to outliers and initialization.
Algorithms:
 K-means: Iteratively assigns points to nearest centroid and recalculates centroids
to minimize intra-cluster variance.
 K-medoids: Similar to K-means but uses actual data points (medoids) as centers,
robust to outliers.
Pros:
 Fast and scalable for large datasets.
 Simple to implement and interpret.
Cons:
 Requires pre-knowledge of kk.
 Sensitive to initialization and outliers.
 Not suitable for non-spherical clusters.

2. Density-based Clustering (Model-based Methods)


Density-based clustering defines clusters as contiguous regions of high data density
separated by areas of lower density. This approach can identify clusters of arbitrary
shapes, handles noise well and does not require predefining the number of clusters,
though its effectiveness depends on chosen density parameters.
Algorithms:
 DBSCAN (Density-Based Spatial Clustering of Applications with Noise): Groups
points with sufficient neighbors; labels sparse points as noise.
 OPTICS(Ordering Points To Identify Clustering Structure): Extends DBSCAN to
handle varying densities.
Pros:
 Handles clusters of varying shapes and sizes.
 Does not require cluster count upfront.
 Effective in noisy datasets.
Cons:
 Difficult to choose parameters like epsilon and min points.
 Less effective for varying density clusters (except OPTICS).

3. Connectivity-based Clustering (Hierarchical Clustering)


Connectivity-based (or hierarchical) clustering builds nested groupings of data by
evaluating how data points are connected to their neighbors. It creates a dendrogram a
tree-like structure that reflects relationships at various granularity levels and does not
require specifying cluster numbers in advance, but can be computationally intensive.
Approaches:
 Agglomerative(Bottom-up): Start with each point as a cluster; iteratively merge
closest clusters.
 Divisive(Top-down): Start with one cluster; iteratively split into smaller clusters.
Pros:
 Provides a full hierarchy, easy to visualize.
 No need to specify number of clusters upfront.
Cons:
 Computationally intensive for large datasets.
 Merging/splitting decisions are irreversible.

4. Distribution-based Clustering

Distribution-based clustering assumes data is generated from a mixture of probability


distributions, such as Gaussian distributions and assigns points to clusters based on
statistical likelihood. This method supports clusters with flexible shapes and overlaps, but
usually requires specifying the number of distributions.
Algorithm:
 Gaussian Mixture Model (GMM): Fits data as a weighted mixture of Gaussian
distributions; assigns data points based on likelihood.
Pros:
 Flexible cluster shapes.
 Provides probabilistic memberships.
 Suitable for overlapping clusters.
Cons:
 Requires specifying number of components.
 Computationally more expensive.
 Sensitive to initialization.

5. Fuzzy Clustering
Fuzzy clustering extends traditional methods by allowing each data point to belong to
multiple clusters with varying degrees of membership. This approach captures ambiguity
and soft boundaries in data and is particularly useful when the clusters overlap or
boundaries are not clear-cut.
Algorithm:
 Fuzzy C-Means: Similar to K-means but with fuzzy memberships updated
iteratively.
Pros:
 Models data ambiguity explicitly.
 Useful for complex or imprecise data.
Cons:
 Choosing fuzziness parameter can be tricky.
 Computational overhead compared to hard clustering.

Use Cases
 Customer Segmentation: Grouping customers based on behavior or demographics
for targeted marketing and personalized services.
 Anomaly Detection: Identifying outliers or fraudulent activities in finance, network
security and sensor data.
 Image Segmentation: Dividing images into meaningful parts for object detection,
medical diagnostics or computer vision tasks.
 Recommendation Systems: Clustering user preferences to recommend movies,
products or content tailored to different groups.
 Market Basket Analysis: Discovering products frequently bought together to
optimize store layouts and promotions.
Association Rule Mining
Association rules are a fundamental concept used to find relationships, correlations or
patterns within large sets of data items. They describe how often itemsets occur together
in transactions and express implications of the form:

X→Y

Where X and Y are disjoint sets of items. This rule suggests that when items in X appear,
items in Y tend to appear as well. Association rules originated from market basket analysis
and help retailers and analysts understand customer behavior by discovering item
associations in transaction data. For example, a rule stating

{Bread,Butter}→{Milk}
indicates that customers who buy bread and butter also tend to buy milk.

Key Components
 Antecedent (X): The "if" part representing one or more items found in
transactions.
 Consequent (Y): The "then" part, representing the items likely to be purchased
when antecedent items appear.
Rules are evaluated based on metrics that quantify their strength and usefulness:
Example Transaction Data
Transaction ID Items

1 Bread, Milk

2 Bread, Diaper, Beer, Eggs

3 Milk, Diaper, Beer, Coke

4 Bread, Milk, Diaper, Beer

5 Bread, Milk, Diaper, Coke


Considering the rule:

{Milk,Diaper}→{Beer}

Use Cases of Association Rule Mining


 Market Basket Analysis: Discover products frequently bought together (e.g.,
“bread and butter”) for cross-selling and promotions.
 Customer Segmentation: Group customers with similar purchase histories to
tailor marketing campaigns.
 Fraud Detection: Identify unusual transaction patterns that may indicate
fraudulent activity.
 Web Usage Mining: Analyze user behavior on websites to improve navigation
and user experience.
 Recommendation Systems: Suggest relevant products to customers based on
their purchase history and preferences.

Applications of Association Rule Mining


Some of the applications of Association Rule Mining are as follows:

 Market-Based Analysis
 Medical Diagnosis
 Census Data

1) Market-Basket Analysis

In most supermarkets, data is collected using barcode scanners. This database is called the
“market basket” database. It contains a large number of past transaction records. Every
record contains the name of all the items each customer purchases in one transaction. From
this data, the stores come to know the inclination and choices of items of the customers.
And according to this information, they decide the store layout and optimize the cataloging
of different items.

A single record contains a list of all the items purchased by a customer in a single
transaction. Knowing which groups are inclined toward which set of items allows these
stores to adjust the store layout and catalog to place them optimally next to one another.
2) Medical Diagnosis

Association rules in medical diagnosis can help physicians diagnose and treat patients.
Diagnosis is a difficult process with many potential errors that can lead to unreliable results.
You can use relational association rule mining to determine the likelihood of illness based on
various factors and symptoms. This application can be further expanded using some
learning techniques on the basis of symptoms and their relationships in accordance with
diseases.

3) Census Data

The concept of Association Rule Mining is also used in dealing with the massive amount of
census data. If properly aligned, this information can be used in planning efficient public
services and businesses.

Algorithms of Association Rule Mining


Some of the algorithms which can be used to generate association rules are as follows:

 Apriori Algorithm
 Eclat Algorithm
 FP-Growth Algorithm

1) Apriori Algorithm

It delivers by characteristic the foremost frequent individual things within the information
and increasing them to larger and bigger item sets as long as those item sets seem ofttimes
enough within the information.

The common itemsets ensured by apriori also are accustomed make sure association rules
that highlight trends within the information. It counts the support of item sets employing a
breadth-first search strategy and a candidate generation perform that takes advantage of
the downward closure property of support.

2) Eclat Algorithm

Eclat denotes equivalence class transformation. The set intersection was supported by its
depth-first search formula. It’s applicable for each successive and parallel execution with
spot-magnifying properties. This can be the associate formula for frequent pattern mining
supported by the item set lattice’s depth-first search cross.

 It is a DFS cross of the prefix tree rather than a lattice.


 For stopping, the branch and a specific technique are used.
3) FP-growth Algorithm

This algorithm is also called a recurring pattern. The FP growth formula is used for locating
frequent item sets terribly dealings data but not for candidate generation.

This was primarily designed to compress the database that provides frequent sets and then
divides the compressed data into conditional database sets.

This conditional database is associated with a frequent set. Each database then undergoes
the process of data mining.

The data source is compressed using the FP-tree data structure.

This algorithm operates in two stages. These are as follows:

 FP-tree construction
 Extract frequently used itemsets

Drawbacks of Association Rule Mining


The primary disadvantages of Association Rule Mining are as follows:

 A lengthy procedure of obtaining monotonous rules.


 Having a large number of discovered rules.
 Low performance of the Association Rule algorithms.
 Consideration of a lot of parameters for obtaining the rules.

You might also like