Welcome to Module 2. In our first module, we established a strong foundation for your project by taking a deep dive into the PM POSHAN scheme, identifying the common ways it can fail, and creating a detailed plan for acquiring the data needed to monitor it. You now have a blueprint for gathering the raw materials: images, text, and metadata.
This brings us to a new, crucial phase: translating the messy, real-world problem of "meal quality violations" into a language that a machine learning model can understand and act upon. This lesson marks the beginning of that translation process. Our goal is to achieve the first learning outcome of this module: to formulate a precise, measurable definition of a 'violation' that can be operationalized using the available data. We will move from the general human concept of a violation to a specific set of instructions that a model can be trained to follow.
The Art of Problem Framing
In data science, this translation process is called problem framing. It's arguably the most critical step in any ML project, as it determines what you build, how you measure success, and whether your final product is actually useful. A poorly framed problem can lead to a technically brilliant model that solves the wrong issue entirely.
The diagram below outlines the key steps in a robust problem framing process. We've already done extensive work on steps 1, 2, and 3 in the previous module. Today, we focus on steps 4 and 5: defining our constraints and creating a focused, solution-agnostic articulation of the problem.

In a professional setting, this initial framing is non-negotiable. It's where you define what "solved" looks like before you write a single line of model training code. Let's watch a short clip that explains how this works in practice.
Steal My Machine Learning Project Template
This video from Marina Wyss provides a professional's template for ML projects. We will focus on the first, most crucial step she outlines: problem framing.
Please watch the section on problem framing and success metrics, from the beginning of the segment. Pay close attention to her distinction between a business metric (the real-world outcome) and an ML metric (the proxy we use to train the model). In your project, reducing meal violations is the business metric; accurately classifying an image is the ML metric.
From General Rules to Specific Violations
So, what is a "violation" in the context of the Mid-Day Meal scheme? The government provides official guidelines, but as we saw in the audit reports from Module 1, the real-world failures are often more specific and varied.
Let's start with the official nutritional guidelines.

This table gives us a precise target: a primary school meal should contain 450 calories and 12g of protein. However, a model looking at a photo of a meal cannot directly measure calories or protein grams. This is our first major constraint and introduces a critical concept in applied ML.
The Need for Proxies
When we cannot directly measure our ideal outcome, we must use a proxy—a measurable signal that is correlated with the outcome we care about. Our job is to find the best possible proxies for "nutritional content" using the data we have.
The Google for Developers guide on ML problem framing explains this well.
Framing an ML problem | Machine Learning
This guide explains the foundational concepts of framing problems for machine learning. We will focus on the concept of proxy labels.
Please read the section titled Proxy labels. Focus on the definition of a proxy label and the examples of issues with potential proxies for the "Recommend useful videos" problem. This will help you think critically about the proxies you'll need to define for meal quality. Notice how a seemingly good proxy, like "user will click play," can lead to unintended consequences like maximizing clickbait. We must be similarly careful with our choices. Read from the start of the section to the end.
With the concept of proxies in mind, we can now begin to deconstruct the broad term "violation" into specific, operational tasks. We will use the audit report from Module 1 as our guide, as it provides a rich, real-world catalog of what goes wrong.
Operationalizing Violation Categories
Let's build a table that translates high-level violation categories into concrete, measurable ML tasks. For each category, we'll define the problem and consider how to frame it for a model.
1. Violation: Insufficient Quantity
This is one of the most common complaints. The official rule is about calories, but our proxy must come from an image or text.
- High-Level Definition: The amount of food served is visibly less than the norm.
- Data Signals:
- Image: A photo showing a plate with very little food.
- Text: A complaint containing phrases like "small portion," "not enough," or "only a little rice."
- ML Framing: Classification or Regression?
- We could frame this as a regression problem: predict the calorie count from the image. This is extremely difficult and likely to fail. It's a classic example of over-engineering.
- A more pragmatic approach is classification. We aren't building a calorie counter; we're building a violation detector. The decision we want to support is binary: "flag this meal for review" or "don't flag."
Framing an ML problem | Machine Learning
This part of the Google guide discusses the difference between classification and regression and, crucially, when to prefer one over the other.
Please read the sections on Classification and Regression. Pay special attention to the two key points at the end of the regression section: "Predict the decision" and "Understand the problem's constraints." This is exactly why we would choose a classification model ([sufficient, insufficient]) over a regression model for portion size.
- Operational Definition: A multi-class image classification task with the output
[class: sufficient, class: insufficient]. This simplifies the problem to one that is learnable from visual evidence.
2. Violation: Poor Hygiene
The audit report (LINK) gave us many concrete examples of this, such as CCHs not wearing aprons, cooking in verandahs, or improper waste disposal.
- High-Level Definition: The meal is prepared or served in an unhygienic environment.
- Data Signals:
- Image: Photos showing dirty kitchens, cooks without protective gear, food stored on the floor, or pests.
- Text: Complaints mentioning "dirt," "insects," "unclean," or "smelled bad."
- ML Framing: This is a perfect candidate for multi-label classification. A single image might contain multiple hygiene violations.
- Operational Definition: A multi-label image classification task. The model's output for a given image would be a set of binary flags, such as
has_violation: {unclean_environment: 1, no_protective_gear: 1, improper_food_storage: 0}.
3. Violation: Missing Food Groups (Poor Variety)
The meal should be balanced. A meal of only rice or only watery dal is a common violation.
- High-Level Definition: The meal lacks required components like protein (dal, eggs) or vegetables.
- Data Signals:
- Image: A photo where only one type of food item (e.g., rice) is visible.
- Text: A complaint like "they only gave us rice" or "no dal was served."
- ML Framing: This requires identifying the food items first. This is not simple classification. It's an object detection task. This is where the YOLO model you're studying becomes essential.
- Operational Definition:
- Use a pre-trained or fine-tuned YOLO model to detect and count food items in the image (e.g.,
[rice, dal, chapati]). - Apply a rule-based logic layer on top of the model's output:
IF 'dal' NOT IN detected_items AND 'egg' NOT IN detected_items THEN flag_violation: 'missing_protein'.
- Use a pre-trained or fine-tuned YOLO model to detect and count food items in the image (e.g.,
4. Violation: Outright Fraud
The audit report (LINK) detailed cases of MDM consumption shown in excess of actual attendance (Section 3.2.5) or meals served to "non-existing schools" (Section 3.4).
- High-Level Definition: Resources are being claimed for meals that were never served or for students who were not present.
- Data Signals: This is not something you can see in a single image or text. It requires combining metadata.
reported_attendance(from official records)student_count_in_image(a very noisy signal, but a possible input)historical_violation_ratefor that school/district.
- ML Framing: This is an anomaly detection or outlier detection problem. We are looking for patterns that deviate significantly from the norm.
- Operational Definition: An anomaly detection model that takes in daily or weekly school-level data and outputs a "fraud risk score" from 0 to 1. A score above a certain threshold (e.g., 0.9) would trigger an alert for manual investigation.
The "banana death" project described in the next video is a surprisingly good, simple analogy for this entire process. It takes a vague concept ("how ripe is this banana?") and operationalizes it into a precise, measurable target for a model ("how many days until it's brown and mushy?").
4 *Real* Machine Learning Projects That Get You Hired - No More Tutorials!
This video discusses several practical ML project ideas. We'll focus on one specific example that perfectly illustrates the process of creating a measurable label from a real-world observation.
Watch the short description of the "Days to banana death" project, from the introduction of the problem. Note how it translates a subjective assessment (ripeness) into a quantifiable regression target (days remaining). This is the same creative-yet-rigorous thinking you need to apply to defining "meal quality."
Your Task: Define Your Violations
You have now seen how to break down the abstract idea of a "violation" into specific, measurable, and operational definitions that an ML model can work with. This exercise is the bedrock of your entire project.
Your task is to create a "Violation Dictionary" for your project. Using the audit report (LINK) and other sources from Module 1, identify at least five distinct types of violations. For each one, fill out the following table. Think of this as the initial draft of your project's constitution.
| Violation Category | High-Level Definition | Potential Data Signal(s) (Image, Text, Metadata) | ML Task Framing (Classification, Regression, Object Detection, etc.) | Operational Definition (The model's specific input & output) |
|---|---|---|---|---|
| e.g., Contamination | Presence of foreign objects or pests in the food. | Image: photo of an insect in rice. Text: "found a fly in my food". | Multi-label Classification | Input: Image, Text. Output: [is_contaminated: 1] |
Don't worry about getting it perfect. This is a living document that will evolve. The goal is to practice the structured thinking of problem framing.
Conclusion
In this lesson, we took the critical first step in translating a real-world problem into a set of machine learning tasks. We've seen that framing a problem isn't about finding a complex model, but about defining the problem with such clarity that the model's job becomes straightforward.
Key Takeaways:
- Problem framing is the process of translating a high-level goal into a precise, measurable task for an ML model.
- When direct measurement is impossible, we must use proxy labels—measurable features that correlate with our desired outcome.
- A single problem like "meal violations" must be broken down into specific sub-problems, each framed as an appropriate ML task (e.g., classification, object detection, anomaly detection).
- Choosing the right frame (e.g., classification over regression) often comes from focusing on the decision you want the model to enable.
In our next lesson, we will continue this process. Now that you have started defining what the violations are, we will focus on mapping them to the data you will collect. You'll learn to classify each violation type by the data modality—image, text, or metadata—most likely to provide strong evidence for it, setting the stage for building our separate baseline models.