⚠️ Bad splitting can make a bad model look amazing. Why this matters: - A practical guide to splitting data (random, group, time) and keeping evaluation honest. This topic appears repeatedly in interviews and real projects, so depth matters. Deep dive: - 🎲 Random split: fine when data points are i.i.d: • No grouping • No time order • Use sklearn's train_test_split with a seed | Practical note: connect this point to a real dataset, tool, or system decision. - 👥 Group split: when the same entity appears multiple times: • Users, devices, patients • Use GroupKFold or GroupShuffleSplit • Same entity MUST NOT appear in both train and test | Practical note: connect this point to a real dataset, tool, or system decision. - 🕐 Time split: for sequential data: • Transactions, sensor logs, prices • Always predict the future from the past • Never shuffle time-series data | Practical note: connect this point to a real dataset, tool, or system decision. - 🔒 Keep a TRUE holdout test set: • For final reporting only • Never tune hyperparameters on it • Touch it exactly ONCE | Practical note: connect this point to a real dataset, tool, or system decision. - 📝 Use seeds for reproducibility and log the exact split strategy used. | Practical note: connect this point to a real dataset, tool, or system decision. How to practice today: - Define one measurable objective and baseline before changing anything. - Implement one small experiment and log outcomes clearly. - Review failure cases and write 3 improvements for the next iteration. Common mistakes to avoid: - Skipping evaluation design and relying only on one metric. - Ignoring edge cases and production constraints (latency/cost/drift). - Not documenting assumptions, data limits, and trade-offs. Mini challenge: - Build a small proof-of-concept on "Python for ML" and publish your learning with metrics + trade-offs. 💬 What kind of data do you work with most: i.i.d, grouped, or time-series? #machinelearning #python #evaluation #datascience #mlops
Data Splitting for Honest Model Evaluation in Machine Learning
More Relevant Posts
-
📊 𝗜𝗳 𝗗𝗮𝘁𝗮 𝗖𝗼𝘂𝗹𝗱 𝗦𝗽𝗲𝗮𝗸… 𝗠𝗮𝘁𝗿𝗶𝘅 𝗔𝗴𝗴𝗿𝗲𝗴𝗮𝘁𝗶𝗼𝗻 𝗪𝗼𝘂𝗹𝗱 𝗕𝗲 𝗜𝘁𝘀 𝗩𝗼𝗶𝗰𝗲 While working with tensors in PyTorch, I came across a realization: 👉 Raw data is noisy. 👉 Aggregation is what turns it into insight. This lecture on 𝗠𝗮𝘁𝗿𝗶𝘅 𝗔𝗴𝗴𝗿𝗲𝗴𝗮𝘁𝗶𝗼𝗻 wasn’t just about functions — it was about 𝘀𝘂𝗺𝗺𝗮𝗿𝗶𝘇𝗶𝗻𝗴 𝗺𝗲𝗮𝗻𝗶𝗻𝗴 𝗳𝗿𝗼𝗺 𝗻𝘂𝗺𝗯𝗲𝗿𝘀. ### 🔍 Let’s Break It Differently Imagine a matrix not as numbers, but as a 𝘀𝘁𝗼𝗿𝘆. Aggregation helps answer: * What’s the 𝗼𝘃𝗲𝗿𝗮𝗹𝗹 𝘁𝗿𝗲𝗻𝗱? → `sum`, `mean` * What’s the 𝗲𝘅𝘁𝗿𝗲𝗺𝗲 𝗯𝗲𝗵𝗮𝘃𝗶𝗼𝗿? → `min`, `max` * What’s the 𝗰𝗲𝗻𝘁𝗿𝗮𝗹 𝘁𝗲𝗻𝗱𝗲𝗻𝗰𝘆? → `median` In one example, a simple matrix revealed: • Sum → 45 • Min → 1 • Max → 9 • Mean & Median → 5 A complete summary — in seconds. ### 🧭 Direction Matters (Dimensions) Aggregation becomes more powerful when direction is involved: * 𝗱𝗶𝗺=𝟬 → collapse rows (analyze columns) * 𝗱𝗶𝗺=𝟭 → collapse columns (analyze rows) Same data. Different perspective. It’s like looking at the same dataset from 𝘁𝘄𝗼 𝗮𝗻𝗴𝗹𝗲𝘀. ### ⏳ Not Just Static — But Sequential Cumulative operations add a time-like behavior: • `cumsum()` → running total • `cumprod()` → running multiplication This is especially useful in: * Time-series analysis * Sequential data modeling ### 🎯 Selective Intelligence Not all data deserves equal attention. We can: • Filter values above a threshold • Count non-zero elements • Extract their positions This is where aggregation meets 𝗱𝗲𝗰𝗶𝘀𝗶𝗼𝗻-𝗺𝗮𝗸𝗶𝗻𝗴. ### ⚖️ Bringing Everything to Scale Normalization (Min-Max scaling): 👉 Converts values into a 𝟬 → 𝟭 𝗿𝗮𝗻𝗴𝗲 Why it matters: * Ensures consistency * Improves model performance * Prevents bias from large values ### 💡 Final Thought Aggregation is not just a function — it’s a 𝗹𝗲𝗻𝘀. It helps us: * Compress data * Highlight patterns * Prepare inputs for machine learning models From raw tensors to meaningful insights… this is where data starts becoming intelligent. #PyTorch #DeepLearning #MachineLearning #ArtificialIntelligence #DataScience #Python #LearningJourney
To view or add a comment, sign in
-
🚀 From Data to Decisions: Why Advanced Pandas & NumPy Still Matter When people talk about data analytics or data science, the conversation often jumps straight to fancy models, AI, and dashboards. But in reality, the real magic happens much earlier — in how you handle your data. Over the past few months, I’ve been diving deeper into advanced usage of Pandas and NumPy, and honestly, it changed how I approach problems. Here are a few things that stood out 👇 🔹 Vectorization over loops Replacing traditional loops with vectorized operations doesn’t just make code faster — it makes it cleaner and more readable. Once you get used to it, there’s no going back. 🔹 Efficient data transformations Using methods like groupby, merge, pivot_table, and window functions properly can turn messy datasets into structured insights in minutes. 🔹 Memory optimization matters Handling large datasets? Choosing the right data types (int32 vs int64, category, etc.) can significantly reduce memory usage and improve performance. 🔹 NumPy under the hood Understanding how NumPy arrays work (broadcasting, indexing, slicing) helps you write more optimized Pandas code — because Pandas is built on top of NumPy. 🔹 Real-world impact Most real datasets are messy. Missing values, duplicates, inconsistent formats — mastering these tools helps you solve actual business problems, not just textbook examples. 💡 My biggest learning: It’s not about writing more code, it’s about writing smarter code. If you're working in data (or planning to), don’t skip the fundamentals. Advanced Pandas & NumPy skills can easily set you apart. Would love to hear — what’s one Pandas/NumPy trick that saved you hours? 👇 #DataAnalytics #Python #Pandas #NumPy #DataScience #Learning #CareerGrowth
To view or add a comment, sign in
-
Day 21: Data Integrity & Context Aggregation in Pandas 🐍🤖 To build robust RAG pipelines and autonomous Agents, you need absolute control over your data flow. Today, I advanced my Pandas speed-run by tackling missing data, combining knowledge sources, and pre-aggregating context. Here are the core engineering takeaways: 🧹 Handling Missing Data: Mastered .isna(), .dropna(), and .fillna(). In an AI pipeline, accidentally feeding a NaN value into an embedding model will cause an instant crash. Sanitizing and structurally filling missing data programmatically is a non-negotiable step for system stability. 🔗 Merging & Concatenation: Explored .merge(), .concat(), and .join(). This is exactly how you combine disparate knowledge sources—like stitching an internal SQL database together with scraped web data—to build a unified, enriched context window for an LLM. 🗂️ Groupby & Aggregation: Learned how to group categorical data and apply mathematical functions using .agg() (like mean, sum, and max). LLMs are notoriously bad at raw arithmetic across large datasets. Pre-aggregating the data at the Pandas level before passing the summarized context to an Agent guarantees accurate, analytical insights. Learning to wrangle and structure data programmatically makes building the "memory" of an Agentic system feel much more intuitive. 📈 #Python #GenAI #AgenticAI #MachineLearning #Pandas #DataEngineering #100DaysOfCode
To view or add a comment, sign in
-
-
I recently worked on a few data science projects involving 𝐜𝐥𝐚𝐬𝐬𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧, 𝐜𝐥𝐮𝐬𝐭𝐞𝐫𝐢𝐧𝐠, and 𝐭𝐢𝐦𝐞 𝐬𝐞𝐫𝐢𝐞𝐬 𝐟𝐨𝐫𝐞𝐜𝐚𝐬𝐭𝐢𝐧𝐠 using Python and common machine learning libraries. Here’s a brief overview of what I did: • Task 1: 𝐁𝐚𝐧𝐤 𝐌𝐚𝐫𝐤𝐞𝐭𝐢𝐧𝐠 – 𝐓𝐞𝐫𝐦 𝐃𝐞𝐩𝐨𝐬𝐢𝐭 𝐏𝐫𝐞𝐝𝐢𝐜𝐭𝐢𝐨𝐧 Built classification models to predict customer subscription behavior and evaluated performance using metrics like F1-score and ROC curve. Also used SHAP for basic model interpretability. GitHub: https://lnkd.in/dpbpX2FF • 𝐓𝐚𝐬𝐤 𝟐: 𝐂𝐮𝐬𝐭𝐨𝐦𝐞𝐫 𝐒𝐞𝐠𝐦𝐞𝐧𝐭𝐚𝐭𝐢𝐨𝐧 Applied K-Means clustering on mall customer data and used PCA for visualization. Based on the clusters, I derived basic marketing insights for each segment. GitHub: https://lnkd.in/dHc56spX • 𝐓𝐚𝐬𝐤 𝟑: 𝐄𝐧𝐞𝐫𝐠𝐲 𝐂𝐨𝐧𝐬𝐮𝐦𝐩𝐭𝐢𝐨𝐧 𝐅𝐨𝐫𝐞𝐜𝐚𝐬𝐭𝐢𝐧𝐠 Worked with household power consumption data, engineered time-based features, and compared forecasting models including ARIMA, Prophet, and XGBoost. GitHub: https://lnkd.in/duy43Wvg 𝐊𝐞𝐲 𝐚𝐫𝐞𝐚𝐬 𝐜𝐨𝐯𝐞𝐫𝐞𝐝: Machine learning (classification & clustering), time series forecasting, feature engineering, and model evaluation. #DataScience #MachineLearning #Python #AI #DataAnalytics #TimeSeriesAnalysis #Clustering #Classification #XGBoost #Pandas #ScikitLearn DevelopersHub Corporation©
To view or add a comment, sign in
-
Day 20: Data Prep Foundation – Mastering Pandas 🐍🐼 To build effective RAG pipelines or Agentic AI, you can't just feed raw, messy data into an LLM. Before converting text into vector embeddings, the data must be cleaned, structured, and filtered. Today, I took a strategic speed-run into Pandas, focusing exactly on what is needed to prep datasets for AI models. Here are the core engineering takeaways from today: 📊 Series vs. DataFrames: Grasped the structural differences between 1D Series and 2D DataFrames. If NumPy is for pure matrix math, Pandas is the ultimate tool for handling structured, tabular data. 🔍 Precision Indexing: Navigating massive datasets using .loc and .iloc to extract exact rows, columns, or specific subsets of data without writing slow Python loops. 🗑️ Data Architecture: Adding and dropping features dynamically. I learned the critical importance of using axis=0/1 and inplace=True to manipulate data directly in memory safely. 🎯 Conditional Selection: This was the highlight! I used complex Boolean logic (with & and |) to filter DataFrames instantly. In an AI context, this is exactly how we isolate the specific chunks of knowledge or documents we want our Agents to access. Pandas feels incredibly intuitive right after completing a deep dive into NumPy. Building that math foundation first is paying off! 📈 #Python #GenAI #AgenticAI #MachineLearning #Pandas #DataEngineering #100DaysOfCode
To view or add a comment, sign in
-
-
Decision Trees: When ML Draws a Flowchart Every time you've played '20 Questions', you've been manually running a decision tree. ML just automates finding the best questions to ask. Day 15 of 60 → Decision Trees — the most human-readable ML algorithm. A decision tree is just a series of if-else questions. Is income > ₹10L? ── YES → Is credit score > 700? → YES → Approve loan ── NO → Reject The model learns WHICH questions to ask and in WHAT ORDER from data. Key parameters: max_depth → how many questions deep (prevents overfitting) min_samples_split → minimum data needed to split a node max_leaf_nodes → limits total decisions Why decision trees are powerful: · Completely interpretable — you can explain every decision · No feature scaling needed · Handles mixed data types · Can capture non-linear relationships The big weakness: They overfit easily with no depth limit. Deep trees = memorized noise. #DecisionTree #MachineLearning #Python #DataScience #60DaysOfML #AI Ex- Banks use decision trees for loan approval decisions — regulators require that decisions be explainable. A decision tree can be printed and shown to a customer: 'We declined because income was below threshold AND credit history was under 2 years.'
To view or add a comment, sign in
-
-
People often treat data cleaning like a quick step. Open the dataset → fix a few things → move on. But in real work… this is where you actually start understanding the data. Because once you dig in, you begin to notice things you didn’t expect. Missing values in important columns. Duplicates quietly affecting results. Inconsistent formats that don’t match. Same information scattered in different places. And that’s where the shift happens. It’s no longer about: Which function should I use? It becomes... What is wrong with this data? What can I trust? What needs to be fixed and why? Python helps, of course. Handling nulls, removing duplicates, reshaping data… But the real work is not in the code. It’s in the decisions you make while cleaning it. Because clean data is not about making it look neat. It’s about making sure whatever comes out of it can be trusted. And once that foundation is strong, everything you build on top starts making sense. If you’re learning data analytics, don’t just focus on syntax. Focus on how you *approach* the data. That’s where the real difference shows up. If you’re trying to get better at this in a more practical way, I’ve been working with people through 1:1 sessions: https://lnkd.in/gWSkyyiv #DataAnalytics #Python #DataCleaning #DataScience #Interviews #AI
To view or add a comment, sign in
-
-
𝐃𝐲𝐧𝐚𝐦𝐢𝐜 𝐔𝐑𝐋𝐬, 𝐉𝐢𝐧𝐣𝐚2 𝐓𝐞𝐦𝐩𝐥𝐚𝐭𝐞𝐬, 𝐚𝐧𝐝 𝐑𝐨𝐮𝐭𝐢𝐧𝐠 𝐢𝐧 𝐅𝐥𝐚𝐬𝐤 I recently learned 𝐃𝐲𝐧𝐚𝐦𝐢𝐜 𝐔𝐑𝐋𝐬, 𝐉𝐢𝐧𝐣𝐚2 𝐓𝐞𝐦𝐩𝐥𝐚𝐭𝐞𝐬, 𝐚𝐧𝐝 𝐑𝐨𝐮𝐭𝐢𝐧𝐠 𝐢𝐧 𝐅𝐥𝐚𝐬𝐤 and this is where Data Science starts becoming real-world applications. Here’s the problem this solves: Most Data Science projects stay static. No user interaction. No dynamic results. No real-world usability. With 𝗗𝘆𝗻𝗮𝗺𝗶𝗰 𝗥𝗼𝘂𝘁𝗶𝗻𝗴 𝗶𝗻 𝗙𝗹𝗮𝘀𝗸, I learned how to capture values directly from URLs and use them inside applications. This allows building dynamic, data-driven systems. I also explored 𝗝𝗶𝗻𝗷𝗮2 𝗧𝗲𝗺𝗽𝗹𝗮𝘁𝗲 𝗘𝗻𝗴𝗶𝗻𝗲, which makes it possible to: • Pass data from Python to HTML • Display dynamic predictions • Use loops and conditions inside templates • Build interactive dashboards Another powerful concept I learned was 𝗿𝗲𝗱𝗶𝗿𝗲𝗰𝘁() and 𝘂𝗿𝗹_𝗳𝗼𝗿(), which helps manage application flow and build scalable Data Science applications. Why this matters in Data Science: → Creating interactive ML prediction apps → Building dashboards with dynamic results → Deploying data-driven tools → Creating user-friendly Data Science applications → Moving from notebooks to real-world systems To reinforce my learning, I created my own structured notes and I'm sharing them as a PDF in this post. Step by step, moving from Data Science learner → Data Science builder #Python #DataScience #Flask #MachineLearning #AI #Jinja2 #WebDevelopment #LearningInPublic #DataScienceJourney
To view or add a comment, sign in
-
Day 10 — LLMs for Data Summarization 500 rows of customer feedback. Summarized in 10 seconds. The problem: A product team had months of customer reviews in a CSV. Manual analysis took 2 days every quarter. By the time insights were ready — decisions were already made. The solution: Python + LLM summarization pipeline. 4 steps to build it: 1️⃣ Load the data df = pd.read_csv("customer_reviews.csv") 2️⃣ Filter low ratings low_ratings = df[df['rating'] <= 2].copy() 3️⃣ Send to LLM with a structured prompt Ask it to identify top issues, frequency, urgency & recommended actions. 4️⃣ Export results to CSV for stakeholders summary_df.to_csv("feedback_summary.csv") Sample output in seconds: Issue Frequency Urgency Late delivery 47% High Poor packaging 31% High Wrong item sent 12% High Before: 2 days of manual review every quarter After: 10 seconds of automated insight That's the value of GenAI applied to a real business problem. #GenAI #Python #LLM #Analytics #DataScience #30DayChallenge
To view or add a comment, sign in
-
Most people think better models = better results. That’s wrong. Most ML failures don’t come from bad algorithms. They come from bad data. You can have: – Perfect architecture – Tuned hyperparameters – State-of-the-art models …and still fail. Why? Because ML doesn’t “think.” It learns patterns from whatever data you give it. Stop learning randomly. Follow a simple path: Excel → SQL → Visualization → Python → AI Focus on one tool at a time. Practice. Build. Repeat. That’s how real skills are built.. 🎯 AI Data Analytics Mastery — Batch 1 is Live! 7 Weeks | 14 Live Classes | Starts 2nd May → Excel + AI Automation → SQL + AI Query Generation → Power BI & DAX → Python + Pandas → AI Agents — LangChain, n8n, Make.com → 2 Real-World Projects Live. Hands-on. No fluff. ✅ Dedicated Placement Assistance included ✅ Doubt Support included 📌 Course Details → https://lnkd.in/gjKXGy9s 🎓 Enroll Now → https://lnkd.in/g-W6YBDu 📞 Questions? Call or WhatsApp: +91 98931 81542 Seats are filling fast — our live batch kicks off 2nd May. 🔥 Save this & tag someone who needs it. 🔖 #DataAnalytics #AITools #PowerBI #Python #GrowDataSkills #CareerGrowth #Upskill #AIAnalytics
To view or add a comment, sign in
Explore related topics
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