🚀 Gradient Descent from Scratch – Learning by Building Batch vs. Stochastic vs. Mini-Batch. 📉 No Scikit-Learn, no PyTorch—just pure Python and math. I implemented all three variants to really understand how they converge: ⏺️Batch Gradient Descent: Great for stable convergence, but computationally heavy on large datasets. ⏺️Stochastic Gradient Descent (SGD): Faster and handles redundancy well, but the convergence path is... noisy. ⏺️Mini-Batch Gradient Descent: The sweet spot. Balances the stability of Batch with the speed of SGD. Building these from the ground up gave me a much deeper appreciation for what happens when we call .fit(). Check out the repo below if you're interested in the math behind the magic! 👇 https://lnkd.in/gDUM8vE5 #MachineLearning #DeepLearning #Python #DataScience #CodingFromScratch
Gradient Descent Variants: Batch, Stochastic, Mini-Batch
More Relevant Posts
-
150 flowers. 4 measurements. 3 species. 1 algorithm that just... gets it. I built a KNN classifier on the Iris dataset — and while the dataset is classic, the process taught me something that no tutorial spells out: The model doesn't "think." It just remembers. K-Nearest Neighbors works by asking "who are your closest neighbors?" — and classifying based on majority vote. No equations being solved. No weights being learned. Just proximity. And yet — it achieves high accuracy on a real classification task. That gap between simplicity and power is what keeps pulling me deeper into ML. What I built: → Loaded & explored the Iris dataset with pandas → Trained a KNN classifier (k=3) using scikit-learn → Evaluated performance with accuracy score + confusion matrix → Built prediction for new, unseen flower samples Another project in the books. Each one teaches me something the last one didn't. 🔗 GitHub: https://lnkd.in/eybDDsdY #MachineLearning #Python #ScikitLearn #KNN #DataScience #BuildingInPublic
To view or add a comment, sign in
-
⚠️ Pandas trap: groupby() silently drops NaN keys by default, groupby() excludes rows where grouping columns contain NaN (dropna=True). This means: • Your training population may shrink • Group sizes may be biased • Downstream thresholds may fail Always define explicitly 💪 : Which rows you learn from. Whether NaN groups should be included (dropna=False). Your data quality assumptions before aggregation 🙅♀️ Silent defaults create silent bias. #Python #Pandas #DataScience #DataEngineering #DataQuality
To view or add a comment, sign in
-
Excited to announce the start of my machine learning blog! This will explore a range of ideas, from underlying theory to practical applications, highlighting concepts important for a modern machine learning researcher. First post: Building a multiprocessing DataLoader from scratch. I break down PyTorch's DataLoader class by building a simplified version, focusing on how Python's multiprocessing module enables parallel data loading whilst training the model. You'll see how multiprocessing queues coordinate between worker processes and the main training loop—and why this matters for your training pipeline. Using a toy dataset, I compare single-process vs. multiprocess loading, ultimately showing how even a simple implementation can lead to massive improvements in loading time (over 6 times faster!). Link to the blog: [https://lnkd.in/eg6abKWg] #pytorch #machinelearning #ML #deeplearning #python
To view or add a comment, sign in
-
-
Algorithms don’t fix bad data. Transformation is the quiet skill that separates models that work from models that just look impressive. We created a simple PDF breaking down: When to log When to scale When to normalize If you're serious about building models that generalize — this is foundational. Interested in a workshop? Let us know. — Team QuantLyft #DataTransformation #DataPreprocessing #FeatureEngineering #DataScience #Statistics #RProgramming #Python
To view or add a comment, sign in
-
Sometimes, the best way to understand how a machine works is by observing it in its simplest form. Last weekend, I spent some time building a tabular Q-Learning simulation from scratch using Python—without any heavy AI libraries—to observe how a digital entity learns to navigate its environment purely through trial, error, and a penalty system. One of the most interesting takeaways from this experiment wasn't the final result, but rather the process of watching the state-value heatmap form in real-time. It mathematically demonstrates that behaviors like risk aversion and route optimization do not need to be explicitly programmed. Instead, they emerge naturally when the machine is allowed to make wrong decisions, hit boundaries, and experience the penalties. I've documented a short observation on the value of letting machines make mistakes in my latest piece. (Link to the full article is in the first comment below 👇) #MachineLearning #ReinforcementLearning #DataScience #Python #DataAnalytics
To view or add a comment, sign in
-
Most people use scipy.optimize and move on. I wanted to understand what's actually happening underneath. So I built three optimization algorithms from scratch in Python, no external solvers, just NumPy: → Truncated Newton: finds local minima efficiently, approximating the Hessian without ever computing it fully → Sequential Penalty: handles constraints by turning them into a penalty, the more you violate them, the harder the algorithm pushes back → Filled Functions: the interesting one. When you're stuck in a local minimum, it builds an artificial "hill" on top of it to force the search elsewhere, that's how you find the global optimum Tested on 20+ benchmark problems. It works. In collaboration with Paolo Pascarelli and Silvia Alonzo Full code + writeup below 👇 https://lnkd.in/d8TwHtcS #python #optimization #numericalcomputing
To view or add a comment, sign in
-
🚀 Excited to share my **Weather Prediction Machine Learning API** built with FastAPI. The model is deployed and accessible through a live API where users can test predictions directly from the browser. 🔗 API Base Link: https://lnkd.in/gVMH3pPw 🔗 API Docs (Try Prediction): https://lnkd.in/g2xS6faJ Built using **Python, FastAPI, and Scikit-learn** as part of my Machine Learning learning journey. #MachineLearning #FastAPI #Python #MLDeployment #LearningJourney
To view or add a comment, sign in
-
-
Gradient Descent explained — with live, runnable Python code. 🐍 I built this interactive notebook that walks through all 3 variants: 📌 Batch Gradient Descent 📌 Stochastic Gradient Descent (SGD) 📌 Mini-Batch Gradient Descent Each one is implemented from scratch using NumPy, with cost function plots so you can literally see the model learning. 🔗 Open the notebook here (no sign-up needed): https://lnkd.in/dKwuP6FU --- This notebook was built on sciFI — an AI-powered Python notebook workspace. The AI copilot wrote the code, fixed the errors, and helped structure the whole thing. I just described what I wanted. If you work with data and Python, it's worth a look 👇 🌐 https://scifi.ink — free beta, no credit card. #DataScience #MachineLearning #Python #GradientDescent #AI #sciFI
To view or add a comment, sign in
-
-
𝗧𝗵𝗶𝘀 𝗦𝗶𝗺𝗽𝗹𝗲 𝗗𝗮𝘁𝗮 𝗦𝗰𝗶𝗲𝗻𝗰𝗲 𝗛𝗮𝗯𝗶𝘁 𝗣𝗿𝗲𝘃𝗲𝗻𝘁𝘀 𝗠𝗮𝗻𝘆 𝗠𝗶𝘀𝘁𝗮𝗸𝗲𝘀 Before training any model, always look at a few rows of your data. df.head() You immediately notice: wrong formats unexpected values columns that don’t make sense Many problems are visible in seconds if you simply look at the data first. Two minutes of checking can save hours of confusion later. #DataScience #MachineLearning #DataAnalytics #Python #AI #LearningInPublic
To view or add a comment, sign in
-
🚀 Problem Solved: Longest Span in Two Binary Arrays Solved the “Longest Span in Two Binary Arrays” problem on GeeksforGeeks using an optimized Prefix Sum + HashMap approach. 🔍 Approach: Instead of checking all subarrays (O(N²)), I transformed the problem by: Creating a difference array (a1[i] - a2[i]) Using Prefix Sum to track cumulative differences Storing first occurrences in a dictionary to efficiently find the longest subarray with sum = 0 ⚡ Performance: ✔ 1113 / 1113 Test Cases Passed ✔ Time Complexity: O(N) ✔ Space Complexity: O(N) This problem strengthened my understanding of: Prefix Sum concepts HashMap optimization techniques Converting problems into standard subarray sum patterns Consistently working on improving my DSA skills to build strong problem-solving fundamentals. 💪 #geekstreak60 #POTDwithGFG #DataStructures #Algorithms #Python #ProblemSolving #CodingJourney #FutureDataScientist
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development