Machine Learning
40.4K subscribers
3.62K photos
29 videos
47 files
648 links
Real Machine Learning โ€” simple, practical, and built on experience.
Learn step by step with clear explanations and working code.

Admin: @HusseinSheikho || @Hussein_Sheikho
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Someone spent several months manually writing a 200-page guide on mathematics and the basics of machine learning. ๐Ÿ“˜

No marketing fluff or endless links between articles. Just an attempt to gather all the most important things in one place. ๐ŸŽฏ

Inside:

โ€ข neural networks: backpropagation, SGD, Adam, BatchNorm; โš™๏ธ
โ€ข classic ML: SVM, Gradient Boosting, K-Means, PCA; ๐Ÿ“Š
โ€ข hardware for AI: Tensor Cores, Systolic Arrays, CUDA; ๐Ÿ–ฅ๏ธ
โ€ข transformers: Multi-Head Attention, KV Cache, LoRA; ๐Ÿง 
โ€ข computer vision: ViT, CNN, MAE, IoU, NMS, VLM; ๐Ÿ‘๏ธ
โ€ข agent systems: ReAct, memory, orchestration, OpenClaw. ๐Ÿค–

The author describes it as the material he would have wanted to receive himself several years ago. ๐Ÿ•ฐ๏ธ

And yes, the entire guide is distributed free of charge. ๐Ÿ†“

https://www.arjunvirk.com/writing/ml-guide

#MachineLearning #AI #DeepLearning #DataScience #NeuralNetworks #Tech

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A

๐Ÿš€ Level up your AI & Data Science skills with HelloEncyclo โ€” a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โœ… 13 courses live + 40+ coming soon
๐ŸŽฏ One access, lifetime updates
๐Ÿ”‘ Use code: PRESALE-BOOK-WAVE-2GFG
๐Ÿ‘‰ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค3
๐ŸŽ SPOTO Mid-Year Sale โ€“ Grab Your IT Certification Success Kit!

๐Ÿ”ฅ Whether you're prepping for #Python, #AI, #Cisco, #PMI, #Fortinet, #AWS, #Azure, #Excel, #Comptia, #ITIL, #Cloud or any other hot certification โ€“ SPOTO has your back with real exam dumps and hands-on training!

โœ… Free Resources:
ใƒปFree Python, Excel, Cyber Security, Cisco, SQL, ITIL, PMP, AWS courses: https://bit.ly/4alTSfk
ใƒปIT Certs E-book: https://bit.ly/49ub0zq
ใƒปIT Exams Skill Test: https://bit.ly/4dVPapB
ใƒปFree AI material and support tools: https://bit.ly/4elzcpl
ใƒปFree Cloud Study Guide: https://bit.ly/4u7sdG0

๐ŸŽ Join SPOTO Mid-Year Lucky Draw:
๐Ÿ“ฑ iPhone 17 ๐Ÿ›’ Free Order
๐Ÿ›’ Amazon Gift $100 ๐Ÿ“˜PMP/ AWS/ CCNA Course


๐Ÿ‘‰ Enter the Draw Now โ†’ https://bit.ly/4uN3lVt

๐Ÿ‘‰ Join Our IT Learning Community for free resources & support:
https://chat.whatsapp.com/FQOG04r9xSiIa2ElhaNUJU
๐Ÿ’ฌ Want exam help? Chat with an admin now:
https://wa.link/knicza

โฐ Mid-Year Deal Ends Soon โ€“ Don't Miss Out!
โค1
๐Ÿ”– A large collection of AI projects for practice

We found a repository that will help you move from theory to real development of AI applications.

Inside are dozens of ready-made projects: AI analytics, RAG systems, OCR applications, code review agents, travel assistants, and much more.

โ›“๏ธ Link to GitHub: https://github.com/Sumanth077/Hands-On-AI-Engineering

#AI #MachineLearning #Python #DataScience #OpenSource #Tech

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A

๐Ÿš€ Level up your AI & Data Science skills with HelloEncyclo โ€” a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โœ… 13 courses live + 40+ coming soon
๐ŸŽฏ One access, lifetime updates
๐Ÿ”‘ Use code: PRESALE-BOOK-WAVE-2GFG
๐Ÿ‘‰ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค5
10 GitHub repositories that are worth checking out for an AI engineer ๐Ÿค–

1. Hands-On AI Engineering ๐Ÿ› ๏ธ

A collection of AI applications and agent systems with practical use cases of LLM.

๐Ÿ‘‰ https://github.com/Sumanth077/Hands-On-AI-Engineering

2. Hands-On Large Language Models ๐Ÿ“˜

Full code from the book Hands-On Large Language Models: from basics to fine-tuning.

๐Ÿ‘‰ https://github.com/HandsOnLLM/Hands-On-Large-Language-Models

3. AI Agents for Beginners ๐ŸŽ“

A free course from Microsoft with 11 lessons on creating AI agents.

๐Ÿ‘‰ https://github.com/microsoft/ai-agents-for-beginners

4. GenAI Agents ๐Ÿค–

A large collection of tutorials and implementations of agent systems.

๐Ÿ‘‰ https://github.com/NirDiamant/GenAI_Agents

5. Made With ML ๐Ÿš€

About the development, deployment, and support of production-ready ML systems.

๐Ÿ‘‰ https://github.com/GokuMohandas/Made-With-ML

6. Learn Harness Engineering โš™๏ธ

A practical course on Harness Engineering for AI agents.

๐Ÿ‘‰ https://github.com/walkinglabs/learn-harness-engineering

7. AutoResearch ๐Ÿ”ฌ

Autonomous cycles of ML experiments from Andrej Karpathy.

๐Ÿ‘‰ https://github.com/karpathy/autoresearch

8. Designing Machine Learning Systems ๐Ÿ“š

Notes and materials from Chip Huyen's book.

๐Ÿ‘‰ https://github.com/chiphuyen/dmls-book

9. Awesome LLM Inference โšก

A collection of materials on LLM inference: Flash Attention, KV Cache, quantization, and more.

๐Ÿ‘‰ https://github.com/xlite-dev/Awesome-LLM-Inference

10. LLM Course ๐Ÿ—บ๏ธ

A practical course on LLM with a roadmap and Colab notebooks.

๐Ÿ‘‰ https://github.com/mlabonne/llm-course

#AI #MachineLearning #LLM #DataScience #Tech #GitHub

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A

๐Ÿš€ Level up your AI & Data Science skills with HelloEncyclo โ€” a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โœ… 13 courses live + 40+ coming soon
๐ŸŽฏ One access, lifetime updates
๐Ÿ”‘ Use code: PRESALE-BOOK-WAVE-2GFG
๐Ÿ‘‰ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค4
This media is not supported in your browser
VIEW IN TELEGRAM
๐Ÿ‘ Xmind AI โ€” a neural network for creating smart mind maps and visualizing ideas! ๐Ÿง โœจ

An AI service that helps structure information, plan projects, and build logical connections between tasks. Simply describe an idea or topic, and the neural network will automatically create a detailed mind map. You can also just upload a photo of a document, notes, or a sketch โ€” Xmind AI will automatically turn it into a structured mind map. ๐Ÿ“๐Ÿ”—

๐Ÿ“Œ Here's the link: xmind.ai

#XmindAI #MindMaps #AI #Productivity #VisualThinking #Innovation

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A

๐Ÿš€ Level up your AI & Data Science skills with HelloEncyclo โ€” a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โœ… 13 courses live + 40+ coming soon
๐ŸŽฏ One access, lifetime updates
๐Ÿ”‘ Use code: PRESALE-BOOK-WAVE-2GFG
๐Ÿ‘‰ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค2
๐Ÿค– Calculating the Self-Attention mechanism in pure PyTorch.

The Attention Mechanism allows transformer neural networks to determine the connection between words in a text and dynamically focus on the most important context. We will step by step implement the basic algorithm Scaled Dot-Product Attention, using classic matrices of queries (Query), keys (Key) and values (Value). This will help us to visually see how the attention weights are mathematically calculated and how the model matches the tokens with each other. ๐Ÿง โœจ

To start, we will install the PyTorch library for performing tensor calculations. ๐Ÿ› ๏ธ

pip install torch

The library has been successfully loaded and is ready for mathematical modeling of transformer layers. โœ…

We will generate random vectors Query, Key and Value to simulate the passage of tokens through linear projections. ๐ŸŽฒ

import torch
import torch.nn.functional as F

q = torch.randn(1, 3, 4) # (batch, seq_len, dim)
k = torch.randn(1, 3, 4)
v = torch.randn(1, 3, 4)

The tensors have been initialized and represent three hidden states for a sequence of three words. ๐Ÿ“

We will calculate the token similarity matrix through the scalar product and then scale it by the square root of the vector dimensions. ๐Ÿ”ข

scores = torch.bmm(q, k.transpose(1, 2)) / (q.shape[-1] ** 0.5)
attention_weights = F.softmax(scores, dim=-1)
output = torch.bmm(attention_weights, v)

The scalar product has been translated into probability weights, based on which the final contextual vector has been formed. ๐Ÿ”„

A control run of the output dimension calculation:

python3 -c "import torch; q, k = torch.randn(1, 3, 4), torch.randn(1, 3, 4); print('Attention OK') if torch.bmm(q, k.transpose(1, 2)).shape == (1, 3, 3) else print('Error')"

Expected output: Attention OK โœ…

The Self-Attention formula lies at the heart of all modern LLMs, allowing them to process long contexts in parallel, unlike old recurrent networks (RNNs). Understanding this base is critically important for working with transformers, optimizing architectures and configuring KV-cache mechanisms. ๐Ÿš€๐Ÿง 

#PyTorch #Transformer #DeepLearning #AI #MachineLearning #LLM

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A

๐Ÿš€ Level up your AI & Data Science skills with HelloEncyclo โ€” a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โœ… 13 courses live + 40+ coming soon
๐ŸŽฏ One access, lifetime updates
๐Ÿ”‘ Use code: PRESALE-BOOK-WAVE-2GFG
๐Ÿ‘‰ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
Please open Telegram to view this post
VIEW IN TELEGRAM
โค5
Classical machine learning equations and diagrams cheat sheet ๐Ÿ“Š

https://github.com/soulmachine/machine-learning-cheat-sheet

#MachineLearning #ML #DataScience #CheatSheet #AI #DeepLearning

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A

๐Ÿš€ Level up your AI & Data Science skills with HelloEncyclo โ€” a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โœ… 13 courses live + 40+ coming soon
๐ŸŽฏ One access, lifetime updates
๐Ÿ”‘ Use code: PRESALE-BOOK-WAVE-2GFG
๐Ÿ‘‰ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค3
A free MIT guide to key computer vision concepts ๐Ÿ“˜

Link: https://visionbook.mit.edu/ ๐Ÿ”—

#ComputerVision #MIT #AI #MachineLearning #Tech #DataScience

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A

๐Ÿš€ Level up your AI & Data Science skills with HelloEncyclo โ€” a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โœ… 13 courses live + 40+ coming soon
๐ŸŽฏ One access, lifetime updates
๐Ÿ”‘ Use code: PRESALE-BOOK-WAVE-2GFG
๐Ÿ‘‰ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค1
This media is not supported in your browser
VIEW IN TELEGRAM
Multi-agent RL is beautiful precisely at the moment when it starts to converge. ๐Ÿค–โœจ

#MultiAgent #RL #ReinforcementLearning #AI #MachineLearning #DeepLearning

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A

๐Ÿš€ Level up your AI & Data Science skills with HelloEncyclo โ€” a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โœ… 13 courses live + 40+ coming soon
๐ŸŽฏ One access, lifetime updates
๐Ÿ”‘ Use code: PRESALE-BOOK-WAVE-2GFG
๐Ÿ‘‰ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค1๐Ÿคฉ1
500 AI/ML/Computer Vision/NLP projects with code ๐Ÿš€

This is a large collection of 500 ready-made projects in the field of machine learning, deep learning, computer vision, and NLP ๐Ÿง 

All examples come with code, so you can not just read them, but immediately analyze and run them โš™๏ธ

โžก๏ธ Link to GitHub:
https://github.com/ashishpatel26/500-AI-Machine-learning-Deep-learning-Computer-vision-NLP-Projects-with-code

#AI #MachineLearning #DeepLearning #ComputerVision #NLP #DataScience

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
โค4
A guide to Loop Engineering has been released โ€” a new approach to working with AI agents

The repository loop-engineering has been published, offering a paradigm shift: instead of manually prompting AI agents, the developer designs a cycle that does this automatically. ๐Ÿ”„๐Ÿค–

The author notes that most people still use Claude Code, Codex, Cursor, and Grok as a regular chat: prompt โ†’ wait โ†’ copy โ†’ correct โ†’ prompt again. Loop Engineering proposes to stop being a "nanny" for the agent and instead build a system where agents work, check, correct, and escalate on their own. ๐Ÿ› ๏ธโš™๏ธ

The repository includes ready-made cycles for daily triage, PR, CI, dependencies, changelog, and issues. It includes CLI for creating cycles, evaluating tokens, auditing the repository, and safely running agents via GitHub Actions. ๐Ÿ“‹โœ…

"Prompt engineering was about how to write better prompts. Loop engineering is about creating a system where agents continue to work without your supervision at every step," the description says. ๐Ÿš€๐Ÿง 

The repository is available on GitHub.

Repository: https://github.com/cobusgreyling/loop-engineering

#LoopEngineering #AI #Agents #GitHub #DevOps #Automation

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
โค5
A Chinese developer has released an open-source replacement for NumPy that performs calculations on GPUs. It's called CuPy ๐Ÿš€. In many cases, it's enough to replace a single line:

import cupy as cp

The same code can run on CUDA up to 100 times faster โšก๏ธ.

What it can do:
โ†’ Compatible with existing NumPy and SciPy code ๐Ÿ› ๏ธ.
โ†’ No need to rewrite the program or learn new syntax ๐Ÿ“.
โ†’ Supports not only CUDA but also AMD ROCm ๐Ÿ’ป.

The project is completely open-source ๐Ÿ“‚:
๐Ÿ”— https://github.com/cupy/cupy

#Python #GPU #NumPy #CuPy #AI #DeepLearning

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
โค5
Don't learn ML by randomly jumping through tutorials. ๐Ÿšซ๐Ÿ“š

DS-ML Bootcamp is a public repository for a Data Science and machine learning course for beginners who want a structured path from zero to practical projects. ๐Ÿš€๐Ÿ“Š

It helps transition from installation and concepts to practical ML work, organizing lessons, assignments, code examples, datasets, and solutions around the main machine learning workflow. ๐Ÿ› ๏ธ๐Ÿง 

Key features:

- End-to-end workflow - covers data collection, preprocessing, train/test split, model selection, training, evaluation, and deployment ๐Ÿ”„๐Ÿ“ˆ
- Lesson-based structure - starts with tools/setup, Data Science, ML, data fundamentals, and regression ๐Ÿ“š๐Ÿงฎ
- Practical materials - assignments give learners structured tasks, not just reading notes โœ๏ธโœ…
- Code + datasets - Python examples and raw CSV datasets included for exercises ๐Ÿ๐Ÿ“‚
- Set up for repetition - the README says you can clone the repository and use Jupyter or VS Code while going through lessons ๐Ÿ’ป๐Ÿ”

Free public repository on GitHub. ๐Ÿ†“
https://github.com/goobolabs/ds-ml-bootcamp

#MachineLearning #DataScience #Coding #Python #AI #Learning

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
โค6
๐Ÿ”ฅ Free IT Cert Resources โ€“ Grab Them While They're Hot!

๐ŸŒˆSPOTO just dropped a bunch of 100% free study kits for 2026 โ€“ covering #Cisco, #AWS, #PMP, #AI, #Python, #Excel, and #Cybersecurity

๐Ÿ’ฅNo signup traps, no hidden fees โ€“ just click and download.

๐Ÿ“˜ FREE Cert Eโ€‘Book โ†’ https://bit.ly/4wkiLAT
๐Ÿชœ Online FREE Course โ†’
https://bit.ly/4vHFJSz
โ˜๏ธ FREE
AI Materials โ†’ https://bit.ly/4wdu7X6
๐Ÿ“Š Cloud Study Guide โ†’
https://bit.ly/4y0HyeW
๐Ÿง  Free Mock Exam โ†’
https://bit.ly/4ff8jos

Tag a friend who's also on this journey โ€“ Get certified together! ๐Ÿ’ช

๐ŸŒ Join the community: https://chat.whatsapp.com/FmbIbbqm2QhKglVpVTSH4d/
๐Ÿ“ฒ Need personalized help? โ†’ https://wa.link/6k7042
โค6
๐Ÿ”ฅ Free IT Cert Resources โ€“ Grab Them While They're Hot!

๐ŸŒˆSPOTO just dropped a bunch of 100% free study kits for 2026 โ€“ covering #Cisco, #AWS, #PMP, #AI, #Python, #Excel, and #Cybersecurity

๐Ÿ’ฅNo signup traps, no hidden fees โ€“ just click and download.

๐Ÿ“˜ FREE Cert Eโ€‘Book โ†’ https://bit.ly/4wkiLAT
๐Ÿชœ Online FREE Course โ†’
https://bit.ly/4vHFJSz
โ˜๏ธ FREE
AI Materials โ†’ https://bit.ly/4wdu7X6
๐Ÿ“Š Cloud Study Guide โ†’
https://bit.ly/4y0HyeW
๐Ÿง  Free Mock Exam โ†’
https://bit.ly/4ff8jos

Tag a friend who's also on this journey โ€“ Get certified together! ๐Ÿ’ช

๐ŸŒ Join the community: https://chat.whatsapp.com/FmbIbbqm2QhKglVpVTSH4d/
๐Ÿ“ฒ Need personalized help? โ†’ https://wa.link/6k7042
โค7
Cheat sheet for Scikit-learn: ๐Ÿ“š Scikit-learn is a Python library for machine learning.

๐Ÿ“ฅ Loading Data - downloading and preparing data.
๐Ÿงผ Preprocessing - standardization, normalization, and feature processing.
๐Ÿ—๏ธ Create Your Model - creating models for classification, regression, and clustering.
๐ŸŽฏ Model Fitting - training the model on data.
๐Ÿ”ฎ Prediction - obtaining forecasts.
๐Ÿ“Š Evaluate Performance - assessing the quality of the model using various metrics.
๐Ÿ”„ Cross-Validation - checking the model on different samples.
โš™๏ธ Tune Your Model - optimizing parameters using Grid Search and Randomized Search.

#ScikitLearn #MachineLearning #Python #DataScience #AI #MLOps

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
โค6๐Ÿ‘2
Reinforcement Learning Methods and Tutorials ๐Ÿง ๐Ÿ“š

In these tutorials for reinforcement learning, it covers from the basic RL algorithms to advanced algorithms developed recent years.

Learning Resources: https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow ๐Ÿš€

Here's a collection of simple materials on methods and practical guides, covering both basic reinforcement learning algorithms and modern, recently developed, and updated advanced algorithms. ๐Ÿ“–โœจ

#ReinforcementLearning #MachineLearning #AI #DeepLearning #TechTutorials #DataScience

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
โค5
Feature Scaling: Why Feature Scaling Affects Model Training

Feature scaling is often overlooked because it seems like just another data preprocessing step. However, in practice, it often helps models train faster and more stably. Imagine one feature has values ranging from 0 to 1, while another has values ranging from 0 to 10,000. Although both features may be equally important for prediction, it's more difficult for the optimizer to work with such data.

This means it has to take more steps to find a good solution. Additionally, regularization becomes less effective because features with different scales require coefficients of different magnitudes. Let's look at how this looks in a simple example.

Install dependencies:
pip install numpy scikit-learn

Import libraries:
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score

Let's create a small synthetic dataset. It will have two features: the first has a normal scale, and the second is about a thousand times larger.

Importantly, both features actually influence the target variable. That is, the only difference between them is the scale.
np.random.seed(42)
x_small = np.random.normal(0, 1, 300)
x_large = np.random.normal(0, 1000, 300)

X = np.vstack([x_small, x_large]).T

y = (x_small + 0.001 * x_large > 0).astype(int)

Now, let's split the data into training and testing sets. We won't scale anything yetโ€”first, let's see how the model behaves on the original data.
X_train, X_test, y_train, y_test = train_test_split(
X, y,
test_size=0.3,
random_state=42,
stratify=y
)

Let's train a logistic regression model without scaling.

In addition to the model's quality, let's also look at the number of iterations (n_iter_). This metric shows how much work the optimizer had to do to find the coefficients.
model = LogisticRegression()
model.fit(X_train, y_train)

pred = model.predict_proba(X_test)[:, 1]

print("ROC-AUC:", roc_auc_score(y_test, pred))
print("Iterations:", model.n_iter_)

Now, let's scale the features to the same scale using StandardScaler.

It calculates the mean and standard deviation only for the training set and then uses the same values for the test set. This is important because the model should not "peek" at the test data during training.

After this transformation, both features are approximately on the same scale, and it becomes easier for the optimizer to work with them.
scaler = StandardScaler()

X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)

Now, let's retrain the model.

We're using the same model, the same data, and the same parameters. The only difference is that the features are now scaled.
model = LogisticRegression()
model.fit(X_train_scaled, y_train)

pred = model.predict_proba(X_test_scaled)[:, 1]

print("ROC-AUC (scaled):", roc_auc_score(y_test, pred))
print("Iterations (scaled):", model.n_iter_)

Most often, the ROC-AUC doesn't change much. However, the number of iterations becomes smaller. This means that the optimizer found a solution faster, and the training was more stable.

๐Ÿ”ฅ Feature scaling is a simple data preprocessing step that, in many cases, allows the model to train faster and more stably. For logistic regression, SVMs, neural networks, and other algorithms that use numerical optimization, it's best not to skip it.

โœจ #DataScience #MachineLearning #Python #Coding #Tech #AI

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
โค4
Diving deep into Deep Learning, Reinforcement Learning, Machine Learning, Computer Vision, and NLP. ๐Ÿค–๐Ÿง 

Lectures: ๐ŸŽ“๐Ÿ“š
https://github.com/kmario23/deep-learning-drizzle

#DeepLearning #MachineLearning #AI #ReinforcementLearning #ComputerVision #NLP

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
โค6
This repository contains a collection of the best resources on PyTorch: https://github.com/ritchieng/the-incredible-pytorch

โœจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk

โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A

#PyTorch #AI #MachineLearning #DeepLearning #Coding #Resources
โค6