Ahmed Kamel - Data Analyst

Website

Ahmed Kamel - Data Analyst Data Analyst skilled in Python, SQL, Excel, and Power BI, passionate about transforming data into actionable insights.

๐ŸŽฏ How to Choose the Right Technique for Customer Segmentation?Customer segmentation is the cornerstone of building preci...
03/10/2026

๐ŸŽฏ How to Choose the Right Technique for Customer Segmentation?

Customer segmentation is the cornerstone of building precise persona profiles and delivering targeted marketing strategies. The goal is simple: transform raw, complex customer data into well-defined, actionable groups.

Here is a quick breakdown of the 5 key techniques featured in the visual:

1๏ธโƒฃ RFM (Recency, Frequency, Monetary):

โ€ข How it works: Uses simple rule-based metrics based on purchasing behavior. โ€ข Best for: Evaluating customer value metrics and transaction history.

2๏ธโƒฃ K-Means Clustering:

โ€ข How it works: An unsupervised method relying on statistical distance. โ€ข Best for: Uncovering natural data-driven groupings based on customer similarity.

3๏ธโƒฃ Hierarchical Clustering:

โ€ข How it works: Builds a nested structure of customer groups. โ€ข Best for: Mapping out hierarchies from broad customer bases to specific micro-segments.

4๏ธโƒฃ Network Segmentation (SNA):

โ€ข How it works: Maps connectivity and relationship dynamics between nodes. โ€ข Best for: Identifying influence, referral networks, and brand communities.

5๏ธโƒฃ Deep Clustering (e.g., VAE):

โ€ข How it works: Employs deep learning models to represent complex feature sets. โ€ข Best for: Capturing subtle, non-linear patterns across multidimensional customer profiles.

๐Ÿ’ก Key Takeaway:

There is NO SINGLE "BEST" METHOD! The right choice always depends on your specific business goals and customer dynamics.

๐Ÿ’ฌ Community Check:

Which segmentation approach do you rely on most in your analytics projects? Let us know below! ๐Ÿ‘‡

๐Ÿ’ก How Does the Support Vector Machine (SVM) Algorithm Work?If you are looking for one of the most precise classification...
30/09/2026

๐Ÿ’ก How Does the Support Vector Machine (SVM) Algorithm Work?

If you are looking for one of the most precise classification algorithms in Machine Learning, Support Vector Machines (SVM) are a fundamental tool! ๐ŸŽฏ

Rather than just drawing any arbitrary boundary to separate data, SVM searches for the Optimal Hyperplaneโ€”the decision boundary that creates the maximum possible margin between different classes.
Here is a step-by-step breakdown of the pipeline:

1๏ธโƒฃ Stage 1: Training Data & Features
The algorithm ingests feature vectors and begins training the model to recognize distinct spatial patterns between groups.

2๏ธโƒฃ Stage 2: Maximum Margin Hyperplane
This is the core of SVM optimization. The model identifies key data points closest to the boundaryโ€”known as Support Vectorsโ€”and calculates the optimal margin using:

Margin = 2 / ||w||

By maximizing this margin, the classifier ensures high generalization accuracy on unseen data.

3๏ธโƒฃ Stage 3: Classification & Decision
When a new data point arrives, the model evaluates its distance relative to the hyperplane to assign a label (e.g., Class 1 / Class A) with high decision confidence.

โš™๏ธ The Kernel Trick (Handling Non-Linear Data):

What if your data cannot be separated by a simple straight line or flat plane?

SVM employs Kernel Functions (Linear, Polynomial, RBF, Sigmoid) to map non-linear features into higher-dimensional spaces where clear decision boundaries can be easily constructed.

๐Ÿ’ฌ Data Science Community Check:
Which Kernel function do you find yourself using most often for non-linear datasets? Let us know in the comments! ๐Ÿ‘‡

๐Ÿ”— A follow-up to my previous post: "Why P-Value Is NOT What You Think"In my previous post, we discussed one of the most ...
29/09/2026

๐Ÿ”— A follow-up to my previous post: "Why P-Value Is NOT What You Think"

In my previous post, we discussed one of the most common misconceptions in statistics:

ยซA p-value of 0.03 does NOT mean there is a 97% chance that your hypothesis is true.ยป

But this raises an important question:

If the p-value doesn't tell us the probability that our hypothesis is trueโ€ฆ what can?

This is where Bayes' Theorem enters the picture. ๐Ÿง 

Let's use a simple example.

Imagine a disease affects 1% of the population.

A diagnostic test has:

99% sensitivity
โ†’ If someone has the disease, the test detects it 99% of the time.

99% specificity
โ†’ If someone doesn't have the disease, the test is negative 99% of the time.

Now imagine someone tests positive.

What's the probability that they actually have the disease?

Many people would instinctively say:

99%

But that's not correct.

Let's look at 10,000 people:

๐Ÿง‘โ€โš•๏ธ 100 actually have the disease.

โ†’ 99% test positive
โ†’ 99 true positives

The remaining 9,900 don't have the disease.

โ†’ 1% still test positive
โ†’ 99 false positives

So we have:

99 true positives
99 false positives

Total positive tests:

198

Therefore:

P(Disease | Positive) = 99 / 198 = 50%

Not 99%.

This is the key idea behind Bayes' Theorem:

ยซP(Hypothesis | Evidence) depends not only on the evidence, but also on how plausible the hypothesis was before seeing the evidence.ยป

And this connects directly to the previous post:

P(Data | Hโ‚€)
is not the same as
P(Hโ‚€ | Data)

The first is the kind of probability we encounter when interpreting a p-value.

The second is the kind of probability we often wish the p-value would give us.

That's why understanding probability requires more than memorizing:

"p < 0.05 = significant."

You need to understand what probability is actually being calculated.

๐Ÿ“Œ Statistics is not just about calculating numbers.
It's about understanding what those numbers actually mean.

P-Value Is NOT What You Think.One of the most common mistakes in statistics is interpreting a p-value as the probability...
24/09/2026

P-Value Is NOT What You Think.

One of the most common mistakes in statistics is interpreting a p-value as the probability that your hypothesis is true.

For example:

p-value = 0.03

This does NOT mean:

โŒ There is a 3% chance that the null hypothesis is true.

โŒ There is a 97% chance that the alternative hypothesis is true.

Soโ€ฆ what does it actually mean?

Imagine we're testing a new drug.

Hโ‚€: The drug has no real effect.
Hโ‚: The drug has a real effect.

After running the experiment, we get:

p = 0.03

The correct interpretation is:

If the null hypothesis were actually true, there would be about a 3% probability of observing a result at least as extreme as the one we obtained.

In other words, we're asking:

"How unusual is our data if Hโ‚€ is true?"

And this is the key distinction:

P(Data | Hโ‚€) โ‰  P(Hโ‚€ | Data)

The p-value tells us something about the data under the assumption that Hโ‚€ is true.

It does NOT directly tell us the probability that Hโ‚€ itself is true.

One more important point:

A small p-value does not automatically mean the effect is large or practically important.

With a sufficiently large sample, even a very small effect can produce a statistically significant p-value.

So whenever you see:

p < 0.05

don't immediately think:

"There is a 95% chance my hypothesis is correct."

Instead, ask:

"How surprising would this result be if the null hypothesis were true?"

That's what the p-value is actually helping us understand.

๐Ÿ“‰ Dimensionality Reduction: Methods & TechniquesImagine working with a dataset containing 500 features.More features don...
22/09/2026

๐Ÿ“‰ Dimensionality Reduction: Methods & Techniques

Imagine working with a dataset containing 500 features.

More features don't always mean more useful information.

High-dimensional data can lead to:

โ€ข Higher computational cost
โ€ข More noise and redundancy
โ€ข Difficult visualization
โ€ข Multicollinearity
โ€ข The Curse of Dimensionality

That's where Dimensionality Reduction comes in.
The goal is to represent high-dimensional data using fewer dimensions, while preserving as much useful information or structure as possible.

Here are some of the most important techniques ๐Ÿ‘‡

1๏ธโƒฃ PCA โ€” Principal Component Analysis

PCA transforms the original features into a smaller number of uncorrelated components.
It tries to preserve the directions with the highest variance.

๐Ÿ“Œ Common uses:

โ€ข Feature compression
โ€ข Noise reduction
โ€ข Data visualization
โ€ข Preprocessing

2๏ธโƒฃ LDA โ€” Linear Discriminant Analysis

Unlike PCA, LDA is a supervised dimensionality reduction technique.

It uses class labels and searches for directions that maximize class separation.

๐Ÿ“Œ Useful when your goal is to reduce dimensions while keeping different classes distinguishable.

3๏ธโƒฃ t-SNE

t-Distributed Stochastic Neighbor Embedding focuses on preserving local relationships between observations.

It's particularly popular for visualizing high-dimensional data in 2D or 3D.

๐Ÿ“Œ Common example:

Visualizing clusters of images, embeddings, or biological data.

โš ๏ธ t-SNE is primarily a visualization technique and shouldn't automatically be treated as a general-purpose feature reduction method for predictive models.

4๏ธโƒฃ UMAP

Uniform Manifold Approximation and Projection (UMAP) is another nonlinear technique designed to preserve important structure in high-dimensional data.

Compared with t-SNE, UMAP is often faster and can better preserve aspects of the global structure.

๐Ÿ“Œ Common uses:

โ€ข Visualization
โ€ข Exploratory analysis
โ€ข Embedding analysis

5๏ธโƒฃ Autoencoders

An Autoencoder is a neural network that learns to compress data into a lower-dimensional representation and then reconstruct the original input.
Input โ†’ Encoder โ†’ Latent Representation โ†’ Decoder โ†’ Reconstruction

The latent representation can capture complex nonlinear patterns in the data.

๐Ÿ”‘ The important idea

Different techniques preserve different things.

PCA โ†’ Variance
LDA โ†’ Class separation
t-SNE โ†’ Local structure
UMAP โ†’ Local + global structure
Autoencoders โ†’ Nonlinear representations

So there isn't a single โ€œbestโ€ dimensionality reduction technique.

The right choice depends on what you want to preserve and what you want to do with the reduced data.

๐Ÿค– Unsupervised Machine LearningWhat if we have dataโ€ฆ but no labels?That's where Unsupervised Machine Learning comes in.U...
20/09/2026

๐Ÿค– Unsupervised Machine Learning

What if we have dataโ€ฆ but no labels?

That's where Unsupervised Machine Learning comes in.

Unlike supervised learning, we don't tell the model what the correct answer is.

Instead, we give it the data and let it discover hidden patterns, structures, or groups.

Here are the main concepts you should know ๐Ÿ‘‡
1๏ธโƒฃ Clustering

The algorithm groups similar observations together.

๐Ÿ“Œ Example:

A company has customer data but doesn't know its customer segments.

Clustering can help discover groups such as:

๐ŸŸข Frequent high-value customers
๐Ÿ”ต Occasional customers
๐ŸŸ  Price-sensitive customers

Common algorithms:

โ€ข K-Means
โ€ข Hierarchical Clustering
โ€ข DBSCAN

2๏ธโƒฃ Dimensionality Reduction

What if your dataset has hundreds of features?

Dimensionality reduction transforms the data into fewer dimensions while trying to preserve important information.

Common techniques:

โ€ข PCA
โ€ข t-SNE
โ€ข UMAP

๐Ÿ“Œ Useful for visualization, noise reduction, and simplifying complex datasets.

3๏ธโƒฃ Anomaly Detection

Sometimes the interesting observations are the ones that don't look normal.

For example:

๐Ÿ’ณ Unusual credit-card transaction
๐Ÿญ Abnormal machine behavior
๐Ÿ” Suspicious network activity

Algorithms such as Isolation Forest can help identify unusual observations.

4๏ธโƒฃ Association Rules

This is about discovering relationships between items.

๐Ÿ›’ Example:

Customers who buy bread + butter may frequently buy milk as well.
A classic application is Market Basket Analysis.

๐Ÿ”‘ The key difference

Supervised Learning:
Data + Labels โ†’ Learn to predict
Unsupervised Learning:
Data without labels โ†’ Discover patterns
The important question isn't always:

โ€œWhat should the model predict?โ€

Sometimes it's:

โ€œWhat can we discover inside the data?โ€ ๐Ÿ”

๐Ÿค– Unsupervised Machine LearningWhat if we have dataโ€ฆ but no labels?That's where Unsupervised Machine Learning comes in.U...
20/09/2026

๐Ÿค– Unsupervised Machine Learning

What if we have dataโ€ฆ but no labels?
That's where Unsupervised Machine Learning comes in.

Unlike supervised learning, we don't tell the model what the correct answer is.
Instead, we give it the data and let it discover hidden patterns, structures, or groups.

Here are the main concepts you should know ๐Ÿ‘‡
1๏ธโƒฃ Clustering

The algorithm groups similar observations together.

๐Ÿ“Œ Example:
A company has customer data but doesn't know its customer segments.

Clustering can help discover groups such as:

๐ŸŸข Frequent high-value customers
๐Ÿ”ต Occasional customers
๐ŸŸ  Price-sensitive customers

Common algorithms:

โ€ข K-Means
โ€ข Hierarchical Clustering
โ€ข DBSCAN

2๏ธโƒฃ Dimensionality Reduction

What if your dataset has hundreds of features?

Dimensionality reduction transforms the data into fewer dimensions while trying to preserve important information.

Common technique:

โ€ข PCA
โ€ข t-SNE
โ€ข UMAP

๐Ÿ“Œ Useful for visualization, noise reduction, and simplifying complex datasets.

3๏ธโƒฃ Anomaly Detection

Sometimes the interesting observations are the ones that don't look normal.

For example:

๐Ÿ’ณ Unusual credit-card transaction
๐Ÿญ Abnormal machine behavior
๐Ÿ” Suspicious network activity

Algorithms such as Isolation Forest can help identify unusual observations.

4๏ธโƒฃ Association Rules

This is about discovering relationships between items.

๐Ÿ›’ Example:

Customers who buy bread + butter may frequently buy milk as well.
A classic application is Market Basket Analysis.

๐Ÿ”‘ The key difference

Supervised Learning:
Data + Labels โ†’ Learn to predict
Unsupervised Learning:
Data without labels โ†’ Discover patterns
The important question isn't always:

โ€œWhat should the model predict?โ€

Sometimes it's:

โ€œWhat can we discover inside the data?โ€ ๐Ÿ”

๐Ÿ“Š Tips in Linear RegressionLinear Regression looks simple:X โ†’ Model โ†’ ลถBut building a good regression model requires mor...
18/09/2026

๐Ÿ“Š Tips in Linear Regression

Linear Regression looks simple:

X โ†’ Model โ†’ ลถ

But building a good regression model requires more than just fitting a line.

Here are some practical tips to keep in mind ๐Ÿ‘‡

1๏ธโƒฃ Start with EDA
Before fitting the model, understand your data.

Check:
โ€ข Missing values
โ€ข Outliers
โ€ข Distributions
โ€ข Correlations
โ€ข Possible relationships between variables

2๏ธโƒฃ Check the relationship
Linear Regression assumes a reasonably linear relationship between predictors and the target.

A scatter plot can reveal a lot before you even train the model.

3๏ธโƒฃ Watch out for outliers
A few extreme observations can strongly affect the regression line and coefficients.

Don't automatically remove them โ€” first investigate why they exist.

4๏ธโƒฃ Check multicollinearity
If predictors are highly correlated with each other, coefficient estimates can become unstable.

Useful tools include:
โ€ข Correlation matrix
โ€ข VIF (Variance Inflation Factor)

5๏ธโƒฃ Don't rely only on Rยฒ
A high Rยฒ doesn't automatically mean your model is good.

Also consider:
โ€ข Adjusted Rยฒ
โ€ข MAE
โ€ข MSE
โ€ข RMSE
โ€ข Residual analysis

6๏ธโƒฃ Always examine residuals
Residuals can tell you whether the model is missing important patterns.

Look for:
โ€ข Non-linearity
โ€ข Heteroscedasticity
โ€ข Outliers
โ€ข Patterns in errors

7๏ธโƒฃ Separate training and testing
Evaluate the model on data it hasn't seen during training.

Otherwise, you may get an overly optimistic estimate of performance.

8๏ธโƒฃ Remember: correlation โ‰  causation
Even if a variable has a strong relationship with the target, that doesn't mean it causes the target to change.

Regression describes relationships; causal conclusions require additional assumptions and study design.

๐Ÿ“Œ The key idea:

ยซDon't treat Linear Regression as just โ€œfit a line.โ€ยป

A good regression workflow is:

Understand the data โ†’ Check assumptions โ†’ Fit the model โ†’ Diagnose residuals โ†’ Evaluate performance โ†’ Interpret carefully

That is where the real statistical thinking begins. ๐Ÿš€

๐Ÿšจ ุชุฎูŠู„ ุฅู† ุงู„ู€ Machine Learning Model ู…ุด ุจุณ ูŠู‚ูˆู„ูƒ ุชูˆู‚ุนู‡โ€ฆ ู„ูƒู† ูƒู…ุงู† ูŠู‚ูˆู„ูƒ ู‡ูˆ ูˆุงุซู‚ ููŠู‡ ู„ุญุฏ ููŠู†!ู…ุซู„ุงู‹ ุนู†ุฏูƒ Model ุจูŠุชูˆู‚ุน ุฃุณุนุงุฑ...
15/09/2026

๐Ÿšจ ุชุฎูŠู„ ุฅู† ุงู„ู€ Machine Learning Model ู…ุด ุจุณ ูŠู‚ูˆู„ูƒ ุชูˆู‚ุนู‡โ€ฆ ู„ูƒู† ูƒู…ุงู† ูŠู‚ูˆู„ูƒ ู‡ูˆ ูˆุงุซู‚ ููŠู‡ ู„ุญุฏ ููŠู†!

ู…ุซู„ุงู‹ ุนู†ุฏูƒ Model ุจูŠุชูˆู‚ุน ุฃุณุนุงุฑ ุงู„ุจูŠูˆุช.

ุงู„ู†ู…ูˆุฐุฌ ู‚ุงู„ูƒ:

๐Ÿ  ุณุนุฑ ุงู„ุจูŠุช ุงู„ู…ุชูˆู‚ุน = $420,000

ุทูŠุจโ€ฆ ุงู„ุณุคุงู„ ู‡ู†ุง:

ู‡ูˆ ู…ู…ูƒู† ูŠูƒูˆู† ุบู„ุท ู‚ุฏ ุฅูŠู‡ุŸ ๐Ÿค”

ุจุฏู„ ู…ุง ุงู„ู†ู…ูˆุฐุฌ ูŠุฏูŠู„ูƒ ุฑู‚ู… ูˆุงุญุฏ ูˆุฎู„ุงุตุŒ ู†ู‚ุฏุฑ ู†ุณุชุฎุฏู… ุญุงุฌุฉ ุงุณู…ู‡ุง:

๐ŸŽฏ Conformal Prediction

ูˆุณุงุนุชู‡ุง ู…ู…ูƒู† ูŠู‚ูˆู„ูƒ:

ุงู„ุณุนุฑ ุงู„ู…ุชูˆู‚ุน = $420k
ูˆุงู„ู€ 90%
Prediction Interval = [$412.6k, $427.4k]

ูŠุนู†ูŠ ุจุฏู„ ู…ุง ุฃู‚ูˆู„ูƒ:

ยซ"ุงู„ุจูŠุช ุณุนุฑู‡ 420 ุฃู„ู."ยป

ุฃู‚ูˆู„ูƒ:

ยซ"ุฃู†ุง ู…ุชูˆู‚ุน ุณุนุฑู‡ 420 ุฃู„ูุŒ ูˆุงู„ู†ุทุงู‚ ุงู„ู…ุชูˆู‚ุน ู„ู„ุณุนุฑ ุงู„ุญู‚ูŠู‚ูŠ ู…ู† 412.6 ู„ู€ 427.4 ุฃู„ู."ยป

ูˆุฏู‡ ุจูŠุฏูŠู†ุง ู…ุนู„ูˆู…ุฉ ู…ู‡ู…ุฉ ุฌุฏุงู‹ ุนู† ู…ุฏู‰ ุนุฏู… ุงู„ูŠู‚ูŠู† ููŠ ุงู„ุชูˆู‚ุน.

---

๐Ÿง  ุทูŠุจ Conformal Prediction ุจุชุดุชุบู„ ุฅุฒุงูŠุŸ

ุงู„ููƒุฑุฉ ุจุจุณุงุทุฉ ุฅู†ู†ุง ุจู†ู‚ุณู… ุงู„ุฏุงุชุง ู„ุฌุฒุฆูŠู†:

1๏ธโƒฃ Training Set

ู†ุฏุฑุจ ุนู„ูŠู‡ ุงู„ู€ Model.

2๏ธโƒฃ Calibration Set

ู†ุณุชุฎุฏู…ู‡ ุนุดุงู† ู†ุดูˆู ุงู„ู†ู…ูˆุฐุฌ ูƒุงู† ุจูŠุบู„ุท ู‚ุฏ ุฅูŠู‡.

ู…ุซู„ุงู‹ ู†ุญุณุจ:

sแตข = |Yแตข โˆ’ ลถแตข|

ูŠุนู†ูŠ ุจุจุณุงุทุฉ:

ู‚ุฏ ุฅูŠู‡ ุงู„ู€ Prediction ุจุชุงุน ุงู„ู†ู…ูˆุฐุฌ ูƒุงู† ุจุนูŠุฏ ุนู† ุงู„ู‚ูŠู…ุฉ ุงู„ุญู‚ูŠู‚ูŠุฉุŸ

ูˆุจุนุฏ ูƒุฏู‡ ุจู†ุงุฎุฏ Quantile ู…ู†ุงุณุจ ู…ู† ุงู„ุฃุฎุทุงุก ุฏูŠุŒ ูˆู†ุณุชุฎุฏู…ู‡ ุนุดุงู† ู†ุญุฏุฏ ุงู„ู€ Prediction Interval.

ู…ุซู„ุงู‹ ู„ูˆ ุงู„ู€ Quantile ุทู„ุน:

q = $7.4k

ูˆุงู„ู€ Model ุชูˆู‚ุน:

$420k

ูŠุจู‚ู‰ ุงู„ู€ interval:

[$420 โˆ’ $7.4k, $420 + $7.4k]

ูŠุนู†ูŠ:

๐ŸŽฏ [$412.6k, $427.4k]

---

๐Ÿ”ฅ ุทุจ ุฅูŠู‡ ุงู„ู…ู…ูŠุฒ ููŠู‡ุงุŸ

ุฃุฌู…ุฏ ุญุงุฌุฉ ุฅู†ูƒ ู…ุด ู…ุญุชุงุฌ ุชุบูŠุฑ ุงู„ู€ Model ุจุชุงุนูƒ.

ู…ู…ูƒู† ุชุณุชุฎุฏู…:

๐Ÿ”น Linear Regression
๐Ÿ”น Random Forest
๐Ÿ”น XGBoost
๐Ÿ”น Neural Networks
๐Ÿ”น ุฃูˆ ุชู‚ุฑูŠุจุงู‹ ุฃูŠ Model ุชุงู†ูŠ

ูŠุนู†ูŠ Conformal Prediction ู…ุด Model ุฌุฏูŠุฏ.

ู‡ูŠ ุฃุดุจู‡ ุจุทุจู‚ุฉ ุจู†ุถูŠูู‡ุง ููˆู‚ ุงู„ู€ Model ุนุดุงู† ุชุณุงุนุฏู†ุง ู†ุนุฑู:

Prediction + Uncertainty

---

๐Ÿ“Š ุทุจ ูŠุนู†ูŠ ุฅูŠู‡ 90% CoverageุŸ

ุฏูŠ ู†ู‚ุทุฉ ู…ู‡ู…ุฉ ุฌุฏุงู‹.

ู„ู…ุง ู†ู‚ูˆู„ ุฅู† ุนู†ุฏู†ุง 90% coverageุŒ ูุงู„ู…ู‚ุตูˆุฏ ู€ู€ ุชุญุช ุงูุชุฑุงุถุงุช ุงู„ุทุฑูŠู‚ุฉ ู€ู€ ุฅู† ุงู„ู€ intervals ุฏูŠ ู‡ุชุญุชูˆูŠ ุงู„ู‚ูŠู…ุฉ ุงู„ุญู‚ูŠู‚ูŠุฉ ููŠ ุญูˆุงู„ูŠ 90% ู…ู† ุงู„ุญุงู„ุงุช ุนู„ู‰ ุงู„ู…ุฏู‰ ุงู„ุทูˆูŠู„.

ูˆุงู„ุถู…ุงู† ู‡ู†ุง Finite-SampleุŒ ูŠุนู†ูŠ ู…ุด ู…ุญุชุงุฌ ู†ุณุชู†ู‰ ุนุฏุฏ ู„ุง ู†ู‡ุงุฆูŠ ู…ู† ุงู„ุจูŠุงู†ุงุช ุนุดุงู† ุงู„ู†ุธุฑูŠุฉ ุชุดุชุบู„.

ูˆูƒู…ุงู† ู…ุด ู„ุงุฒู… ู†ูุชุฑุถ ุฅู† ุงู„ุจูŠุงู†ุงุช ู…ุงุดูŠุฉ ุนู„ู‰ Normal Distribution.

---

โš ๏ธ ุจุณ ุฎุฏ ุจุงู„ูƒ ู…ู† ูƒุงู… ู†ู‚ุทุฉ

Conformal Prediction ู…ุด ุณุญุฑ. ๐Ÿ˜„

ู„ูˆ ุงู„ู€ Model ุจุชุงุนูƒ ุณูŠุฆุŒ ุบุงู„ุจุงู‹ ุงู„ู€ intervals ู‡ุชูƒูˆู† ุฃูˆุณุน.

ูŠุนู†ูŠ ู‡ูŠ ู…ุด ู‡ุชุฎู„ูŠ ุงู„ู€ Model ูŠุชู†ุจุฃ ุฃุญุณู†.

ู‡ูŠ ุจุณ ุจุชุณุงุนุฏูƒ ุชูƒูˆู† ุตุฑูŠุญ ุฅุญุตุงุฆูŠุงู‹ ู…ุน ุนุฏู… ุงู„ูŠู‚ูŠู† ุงู„ู…ูˆุฌูˆุฏ ููŠ ุงู„ุชูˆู‚ุน.

ูƒู…ุงู† ุงู„ู€ 90% ุฏูŠ Marginal CoverageุŒ ูŠุนู†ูŠ ู…ุด ุดุฑุท ูƒู„ Group ุฃูˆ ูƒู„ ูุฑุฏ ูŠุงุฎุฏ ู†ูุณ ู…ุณุชูˆู‰ ุงู„ุชุบุทูŠุฉ.

ูˆููŠ ุญุงู„ุฉ ุงู„ู€ Time Series ุฃูˆ ู„ู…ุง ุชูˆุฒูŠุน ุงู„ุจูŠุงู†ุงุช ุจูŠุชุบูŠุฑ ู…ุน ุงู„ูˆู‚ุชุŒ ุงู„ู…ูˆุถูˆุน ุจูŠุจู‚ู‰ ุฃูƒุซุฑ ุชุนู‚ูŠุฏุงู‹ุŒ ู„ุฃู† ุงู„ู€ Exchangeability ุงู„ู„ูŠ ุจูŠุนุชู…ุฏ ุนู„ูŠู‡ุง ุงู„ุถู…ุงู† ุงู„ุฃุณุงุณูŠ ู…ู…ูƒู† ู…ุง ุชูƒูˆู†ุด ู…ุชุญู‚ู‚ุฉ.

---

๐Ÿš€ ูˆููŠู‡ ุทุฑู‚ ู…ุชู‚ุฏู…ุฉ ูƒู…ุงู†

ู„ู…ุง ู†ุญุชุงุฌ Prediction Intervals ุฃุฐูƒู‰ ูˆุฃูƒุซุฑ ุชูƒูŠูุงู‹ ู…ุน ุงู„ุจูŠุงู†ุงุชุŒ ููŠู‡ Extensions ุฒูŠ:

๐Ÿ”น Normalized Conformal Prediction
ู„ู…ุง ุญุฌู… ุงู„ุฎุทุฃ ูŠุฎุชู„ู ู…ู† ุญุงู„ุฉ ู„ู„ุชุงู†ูŠุฉ.

๐Ÿ”น CQR โ€” Conformalized Quantile Regression
ุนุดุงู† ู†ุนู…ู„ intervals ุนุฑุถู‡ุง ูŠุชุบูŠุฑ ุญุณุจ ุฎุตุงุฆุต ุงู„ู€ input.

๐Ÿ”น Mondrian Conformal Prediction
ุนุดุงู† ู†ุชุนุงู…ู„ ู…ุน Groups ู…ุญุฏุฏุฉ.

๐Ÿ”น Conformal Risk Control
ุนุดุงู† ู†ุชุญูƒู… ููŠ ุฃู†ูˆุงุน ู…ุฎุชู„ูุฉ ู…ู† ุงู„ู€ RiskุŒ ู…ุด ุจุณ ู†ุณุจุฉ ุงู„ู€ miscoverage.

---

๐ŸŽฏ ุงู„ุฎู„ุงุตุฉ

ุงู„ู€ Machine Learning Model ุงู„ุนุงุฏูŠ ู…ู…ูƒู† ูŠู‚ูˆู„ูƒ:

ยซ"ุฃู†ุง ู…ุชูˆู‚ุน ุณุนุฑ ุงู„ุจูŠุช = $420k."ยป

ู„ูƒู† ุจุงุณุชุฎุฏุงู… Conformal Prediction ู…ู…ูƒู† ุชู‚ูˆู„:

ยซ"ุฃู†ุง ู…ุชูˆู‚ุน $420kุŒ ูˆุฏู‡ ุงู„ู†ุทุงู‚ ุงู„ู„ูŠ ู…ุชูˆู‚ุน ุงู„ู‚ูŠู…ุฉ ุงู„ุญู‚ูŠู‚ูŠุฉ ุชู‚ุน ุฌูˆุงู‡ุŒ ู…ุน ู…ุณุชูˆู‰ ุชุบุทูŠุฉ ุฅุญุตุงุฆูŠ ู…ุญุฏุฏ."ยป

ูˆุฏู‡ ูุฑู‚ ู…ู‡ู… ุฌุฏุงู‹.

ู„ุฃู† ููŠ ุงู„ู€ Data Science ู…ุด ุฏุงูŠู…ุงู‹ ุงู„ู…ู‡ู… ุฅู†ูƒ ุชู‚ูˆู„:

"ุฅูŠู‡ ุงู„ุชูˆู‚ุนุŸ"

ุฃุญูŠุงู†ุงู‹ ุงู„ุฃู‡ู… ุฅู†ูƒ ุชุนุฑู:

"ู‚ุฏ ุฅูŠู‡ ุฃู‚ุฏุฑ ุฃุซู‚ ููŠ ุงู„ุชูˆู‚ุน ุฏู‡ุŸ" ๐ŸŽฏ

๐Ÿ”„ Interaction Effects in OLS Models โ€” When One Variable Changes the Effect of AnotherIn a standard Linear Regression mod...
07/09/2026

๐Ÿ”„ Interaction Effects in OLS Models โ€” When One Variable Changes the Effect of Another

In a standard Linear Regression model, we usually assume that each feature has its own independent effect on the target.
For example:

How does advertising spend affect sales?

A simple OLS model might look like:
Sales = ฮฒโ‚€ + ฮฒโ‚ ร— Advertising
This assumes that every additional dollar spent on advertising has the same effect on sales.
But what if the effect of advertising depends on another variable?
For example:

Does advertising work equally well for every product?

Probably not.
This is where Interaction Effects become important.

๐ŸŽฏ A Simple Example

Imagine two variables:

Advertising Spend

Product Quality

You want to predict:

Sales

Without an interaction term:
Sales = ฮฒโ‚€ + ฮฒโ‚(Advertising) + ฮฒโ‚‚(Quality)
This model assumes:

Advertising affects sales.

Product quality affects sales.

But the effect of advertising is independent of product quality.

Now consider two products.

Product A: Low Quality

Increasing advertising may bring more customers initially, but poor product quality might limit future sales.

Product B: High Quality

Advertising may be much more effective because customers are more likely to respond positively.
So the effect of Advertising depends on Product Quality.
We can represent this using an interaction.

๐Ÿงฎ Adding an Interaction Term

The model becomes:
Sales = ฮฒโ‚€ + ฮฒโ‚(Advertising) + ฮฒโ‚‚(Quality) + ฮฒโ‚ƒ(Advertising ร— Quality)
The new term:
Advertising ร— Quality
is called an Interaction Term.
The coefficient ฮฒโ‚ƒ tells us whether the relationship between Advertising and Sales changes depending on Product Quality.

๐Ÿง  How to Interpret It?

Suppose we have:
Sales = 100 + 5 ร— Advertising + 20 ร— Quality + 3 ร— Advertising ร— Quality
The marginal effect of Advertising is no longer simply 5.
It becomes:
Effect of Advertising = 5 + 3 ร— Quality
Let's see what happens.

If Quality = 1

Effect of Advertising:
5 + 3(1) = 8
Every additional unit of advertising increases predicted sales by 8 units.

If Quality = 3

Effect of Advertising:
5 + 3(3) = 14
Now the same increase in advertising increases predicted sales by 14 units.
๐Ÿ“Œ The effect of Advertising changes depending on Quality.
That is exactly what an interaction means.

๐Ÿ“Š Interaction Between Categorical Variables

Interactions are not limited to numerical variables.
Imagine:

Training Program: Yes / No

Gender: Male / Female

You want to study employee performance.
An interaction can answer:

Does the training program have the same effect across different groups?

Without an interaction, the model assumes the training effect is identical for everyone.
With an interaction, the effect is allowed to vary between groups.

โš ๏ธ A Common Mistake

One important rule:

If you include an interaction term, you should generally also include the main effects.

For example:
Instead of:
Y ~ Xโ‚ ร— Xโ‚‚ only
You typically include:
Y ~ Xโ‚ + Xโ‚‚ + Xโ‚:Xโ‚‚
In statistical notation:
Y ~ Xโ‚ * Xโ‚‚
The * usually expands to:
Xโ‚ + Xโ‚‚ + Xโ‚:Xโ‚‚
While:
Xโ‚:Xโ‚‚
represents only the interaction term.

๐Ÿ”ฌ Why Are Interactions Important?

Without interaction terms, your model assumes that relationships are constant.
But in the real world:

The effect of education may depend on experience.

The effect of advertising may depend on product quality.

The effect of a drug may depend on age.

The effect of price may depend on customer income.

Interactions allow the model to capture these conditional relationships.

๐Ÿ”‘ The Big Idea

A regular regression coefficient answers:

"What is the effect of X?"

An interaction asks a more interesting question:

"How does the effect of X change when Z changes?"

That's why interaction effects are powerful.
They allow a simple linear model to represent relationships that are more complex than a single fixed effect.

In one sentence:

An interaction exists when the effect of one predictor on the target depends on the value of another predictor.

Address

Alexandria

Alerts

Be the first to know and let us send you an email when Ahmed Kamel - Data Analyst posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Shortcuts

Share