Forwarded from Machine Learning
Data leakage is one of the main reasons why ML demos look impressive... and then fail in production. ๐
The model didn't become smarter.
It just happened to see the correct answers in advance.
In 4 minutes, you'll understand where data leaks hide. ๐
Let's break it down below: ๐
1. Data Leakage ๐ณ๏ธ
Data leakage occurs when information that won't be available at the time of actual prediction is used during the model training process.
Because of this, metrics on the validation stage can look much better than the actual quality of the model on new, previously unseen data.
2. Model Evaluation โ๏ธ
The test set isn't just "additional data".
It's a simulation of the future.
Only train the model on the information that would have been available to you at the time of prediction.
Evaluate it on examples that the model couldn't have influenced during training.
3. Direct Leakage ๐จ
This is the most obvious type of leakage.
Examples:
- a field with information from the future;
- an ID that encodes the target variable;
- a variable that appears only after an event has occurred;
- duplicate records in both the training and test sets.
If a feature doesn't exist at the time of inference (prediction), then it's likely a source of data leakage.
4. Indirect Leakage ๐ต๏ธ
This is the type of leakage that most often traps teams.
You perform normalization, imputation, feature selection, outlier removal, or dimensionality reduction before splitting the data into a training and test set.
The model didn't directly see the data from the test set.
But your preprocessing pipeline already saw it.
5. Train/Test Split โ๏ธ
Wrong:
Right:
The same idea applies to imputers, encoders, feature selection, PCA, and any preprocessing step that is trained on the data.
6. Cross-Validation ๐
Each fold is a mini-experiment with a training and test set.
Therefore, preprocessing should be performed within each fold.
If you prepared the entire dataset once and then ran cross-validation, each fold would already have had access to its held-out data.
7. Pipelines ๐ ๏ธ
A pipeline isn't just a way to make the code cleaner.
It's also a defense against data leakage.
Combine preprocessing, feature selection, and the model into a single pipeline, and then pass this pipeline to cross-validation or hyperparameter search (grid search).
8. AI Engineering Version ๐ค
Data leaks also occur in RAG systems and when evaluating LLMs.
Leakage occurs when you tune chunks, prompts, re-rankers, thresholds, or examples on the same evaluation dataset that you later present as "held-out".
As a result, your benchmark turns into training data.
9. Leakage Checklist โ
Before trusting the obtained metric, ask yourself:
- Could this feature exist at the time of prediction?
- Was any transformation (transform) step trained (fit) on the test data?
- Did cross-validation include the entire pipeline?
- Were we tuning parameters on the final evaluation dataset?
If the answer is "yes", then the metric likely doesn't reflect the actual quality of the model.
#MachineLearning #DataScience #MLOps #DataLeakage #ArtificialIntelligence #TechTips
โจ Join Best TG Channels https://t.me/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
The model didn't become smarter.
It just happened to see the correct answers in advance.
In 4 minutes, you'll understand where data leaks hide. ๐
Let's break it down below: ๐
1. Data Leakage ๐ณ๏ธ
Data leakage occurs when information that won't be available at the time of actual prediction is used during the model training process.
Because of this, metrics on the validation stage can look much better than the actual quality of the model on new, previously unseen data.
2. Model Evaluation โ๏ธ
The test set isn't just "additional data".
It's a simulation of the future.
Only train the model on the information that would have been available to you at the time of prediction.
Evaluate it on examples that the model couldn't have influenced during training.
3. Direct Leakage ๐จ
This is the most obvious type of leakage.
Examples:
- a field with information from the future;
- an ID that encodes the target variable;
- a variable that appears only after an event has occurred;
- duplicate records in both the training and test sets.
If a feature doesn't exist at the time of inference (prediction), then it's likely a source of data leakage.
4. Indirect Leakage ๐ต๏ธ
This is the type of leakage that most often traps teams.
You perform normalization, imputation, feature selection, outlier removal, or dimensionality reduction before splitting the data into a training and test set.
The model didn't directly see the data from the test set.
But your preprocessing pipeline already saw it.
5. Train/Test Split โ๏ธ
Wrong:
fit the scaler on all data โ split the data โ evaluate
Right:
split the data โ fit the scaler only on the training set โ apply it to both the training and test sets
The same idea applies to imputers, encoders, feature selection, PCA, and any preprocessing step that is trained on the data.
6. Cross-Validation ๐
Each fold is a mini-experiment with a training and test set.
Therefore, preprocessing should be performed within each fold.
If you prepared the entire dataset once and then ran cross-validation, each fold would already have had access to its held-out data.
7. Pipelines ๐ ๏ธ
A pipeline isn't just a way to make the code cleaner.
It's also a defense against data leakage.
Combine preprocessing, feature selection, and the model into a single pipeline, and then pass this pipeline to cross-validation or hyperparameter search (grid search).
8. AI Engineering Version ๐ค
Data leaks also occur in RAG systems and when evaluating LLMs.
Leakage occurs when you tune chunks, prompts, re-rankers, thresholds, or examples on the same evaluation dataset that you later present as "held-out".
As a result, your benchmark turns into training data.
9. Leakage Checklist โ
Before trusting the obtained metric, ask yourself:
- Could this feature exist at the time of prediction?
- Was any transformation (transform) step trained (fit) on the test data?
- Did cross-validation include the entire pipeline?
- Were we tuning parameters on the final evaluation dataset?
If the answer is "yes", then the metric likely doesn't reflect the actual quality of the model.
#MachineLearning #DataScience #MLOps #DataLeakage #ArtificialIntelligence #TechTips
โจ Join Best TG Channels https://t.me/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Telegram
AI PYTHON ๐
Youโve been invited to add the folder โAI PYTHON ๐โ, which includes 14 chats.
โค6
Forwarded from Github Top Repositories
๐ DataTalksClub/data-engineering-zoomcamp caught my eye on GitHub Trending today.
๐ https://github.com/DataTalksClub/data-engineering-zoomcamp
๐ Data Engineering Zoomcamp is a free 9-week course on building production-ready data pipelines. The next cohort starts in January 2026. Join the course here ๐๐ผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The Data Engineering Zoomcamp is a free 9-week course that covers the fundamentals of data engineering. It's designed to help you build an end-to-end data pipeline from scratch, with hands-on experience using industry-standard tools and best practices.
Key features of the course include structured modules, hands-on workshops, and a final project to reinforce your learning. You'll learn about
The course is suitable for anyone with basic coding experience and familiarity with
The course has a strong community and support system, with a dedicated #course-data-engineering channel on Slack for discussions and troubleshooting.
The course is taught by experienced instructors, including Alexey Grigorev and Michael Shoemaker, and is sponsored by companies like Kestra and Bruin.
Overall, the Data Engineering Zoomcamp is a great resource for anyone looking to learn data engineering fundamentals and build a career in the field.
So, what are you waiting for? Join the course and start building your skills today - it's a
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง Channel: https://t.me/GithubRe
๐ https://github.com/DataTalksClub/data-engineering-zoomcamp
๐ Data Engineering Zoomcamp is a free 9-week course on building production-ready data pipelines. The next cohort starts in January 2026. Join the course here ๐๐ผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The Data Engineering Zoomcamp is a free 9-week course that covers the fundamentals of data engineering. It's designed to help you build an end-to-end data pipeline from scratch, with hands-on experience using industry-standard tools and best practices.
Key features of the course include structured modules, hands-on workshops, and a final project to reinforce your learning. You'll learn about
containerization, infrastructure as code, workflow orchestration, data warehousing, and analytics engineering. The course is suitable for anyone with basic coding experience and familiarity with
SQL. No prior data engineering experience is necessary. You can enroll in the course by registering for the next cohort or following the self-paced learning path.The course has a strong community and support system, with a dedicated #course-data-engineering channel on Slack for discussions and troubleshooting.
The course is taught by experienced instructors, including Alexey Grigorev and Michael Shoemaker, and is sponsored by companies like Kestra and Bruin.
Overall, the Data Engineering Zoomcamp is a great resource for anyone looking to learn data engineering fundamentals and build a career in the field.
So, what are you waiting for? Join the course and start building your skills today - it's a
free 9-week course that can change your career!โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง Channel: https://t.me/GithubRe
โค5
Interactive Explainer ๐ง โจ
The Anatomy of an LLM ๐
A visual walk through the machinery inside a large language model: from raw text, to tokens, to vectors, to attention, to the next token. โ๏ธ๐งฌ
๐ Link: https://www.royvanrijn.com/anatomy-of-an-llm/
#LLM #AI #Tech #NeuralNetworks #MachineLearning #DeepLearning
โจ Join Best TG Channels https://t.me/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
The Anatomy of an LLM ๐
A visual walk through the machinery inside a large language model: from raw text, to tokens, to vectors, to attention, to the next token. โ๏ธ๐งฌ
๐ Link: https://www.royvanrijn.com/anatomy-of-an-llm/
#LLM #AI #Tech #NeuralNetworks #MachineLearning #DeepLearning
โจ Join Best TG Channels https://t.me/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
Roy van Rijn
The Anatomy of an LLM | Interactive Visual Guide to How Language Models Work
An interactive visual explainer for developers showing how LLMs work, from tokenization and embeddings to attention, transformers, training, KV cache, and quantization.
โค8
Forwarded from Machine Learning
FREE MIT books on AI and Machine Learning: ๐๐ค
1. Foundations of Machine Learning cs.nyu.edu/~mohri/mlbook/
2. Understanding Deep Learning udlbook.github.io/udlbook/
3. Introduction to Machine Learning Systems โฏ Vol 1: mlsysbook.ai/vol1/assets/do โฏ Vol 2: mlsysbook.ai/vol2/assets/do
4. Algorithms for ML algorithmsbook.com
5. Deep Learning deeplearningbook.org
6. Reinforcement Learning andrew.cmu.edu/course/10-703/
7. Distributional Reinforcement Learning direct.mit.edu/books/oa-monog
8. Multi Agent Reinforcement Learning marl-book.com
9. Agents in the Long Game of AI direct.mit.edu/books/oa-monog
10. Fairness and Machine Learning fairmlbook.org
11. Probabilistic Machine Learning
โฏ Part 1 : probml.github.io/pml-book/book1
โฏ Part 2 : probml.github.io/pml-book/book2
#MIT #AI #MachineLearning #DeepLearning #ReinforcementLearning #FreeBooks
โจ Join Best TG Channels https://t.me/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
1. Foundations of Machine Learning cs.nyu.edu/~mohri/mlbook/
2. Understanding Deep Learning udlbook.github.io/udlbook/
3. Introduction to Machine Learning Systems โฏ Vol 1: mlsysbook.ai/vol1/assets/do โฏ Vol 2: mlsysbook.ai/vol2/assets/do
4. Algorithms for ML algorithmsbook.com
5. Deep Learning deeplearningbook.org
6. Reinforcement Learning andrew.cmu.edu/course/10-703/
7. Distributional Reinforcement Learning direct.mit.edu/books/oa-monog
8. Multi Agent Reinforcement Learning marl-book.com
9. Agents in the Long Game of AI direct.mit.edu/books/oa-monog
10. Fairness and Machine Learning fairmlbook.org
11. Probabilistic Machine Learning
โฏ Part 1 : probml.github.io/pml-book/book1
โฏ Part 2 : probml.github.io/pml-book/book2
#MIT #AI #MachineLearning #DeepLearning #ReinforcementLearning #FreeBooks
โจ Join Best TG Channels https://t.me/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
โค5
๐ฃ HelloEncyclo Presale
โ Now Open
๐ 40% OFF ยท first 250 members only
Code: PRESALE-BOOK-WAVE-2GFG
๐ง Inside: Gen-AI, LLMs, RAG, Data Science, ML, Deep Learning, SQL, Advanced Java, Math for AI
๐ 13 live now ยท 40+ in 2โ3 weeks ยท full library in ~2 months
๐ก 15-day money-back guarantee
โ ๏ธ Log in with Gmail to apply (valid once).
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
The discount disappears with the last seat. Don't sleep on it.
โ Now Open
๐ 40% OFF ยท first 250 members only
Code: PRESALE-BOOK-WAVE-2GFG
๐ง Inside: Gen-AI, LLMs, RAG, Data Science, ML, Deep Learning, SQL, Advanced Java, Math for AI
๐ 13 live now ยท 40+ in 2โ3 weeks ยท full library in ~2 months
๐ก 15-day money-back guarantee
โ ๏ธ Log in with Gmail to apply (valid once).
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
The discount disappears with the last seat. Don't sleep on it.
โค3
Machine Learning with Python
Photo
Unmissable opportunity ๐
Please open Telegram to view this post
VIEW IN TELEGRAM