Skip to main content
Data Management for Machine Learning

Machine Learning Lifecycle, Data Pipelines, and Deployment

Published: 2026-09-15
Level: postgraduate
Audience: Postgraduate students studying Data Management for Machine Learning

Prerequisite Knowledge

This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.

Previously Covered in This Subject

  • Three levels of ML software (data, model, code) — covered in Lecture 6
  • ETL versus ELT and lake, warehouse, lakehouse storage — covered in Lecture 5
  • Exploratory analysis, five-point summary and correlation checks — covered in Lecture 5
  • Feature engineering, binning and derived fields such as car age — covered in Lecture 4
  • Train, validation and test splits, leakage, underfit and overfit — covered in Lecture 11
  • CRISP-DM lifecycle, feature stores and model registry with drift loop — covered in Lecture 7
  • Metadata, lineage, contracts and governance — covered in Lecture 8
  • Deployment controls, retraining, alarms, RPO and RTO recovery aims — covered in Lecture 13

16.1 Iterative Lifecycle and Three Levels of Machine Learning Software

16.1.1 Machine Learning as an Iterative Continuous Cycle

A single trained model is not a product. Why do teams that train a good model still fail in production? Because data shifts, goals shift, and code around the model ages. The fix is a loop that keeps running, not a line that ends at training.

Machine learning grew out of artificial intelligence (machines doing tasks that need judgment). A machine learns from given data. It uses data sources and compute sources. Compute can be cloud based or local.

A workload (the full unit of work run on compute, from data load through algorithm run to result return) is the atom of this cycle. Each workload takes data in, runs an algorithm, and returns a result. Machine learning workloads let algorithms learn from data through a repeated and ongoing cycle. Two words matter here: iterative and continuous. Iterative means each pass builds on the last pass. Continuous means the passes never stop after first deployment.

The lecture presents this as an iterative continuous cycle with three assets called data, model, and code. That phrase is worth memorizing word for word, because it returns in every later stage from ingestion to monitoring.

Why a cycle at all? A software lifecycle gives clarity to software work. It moves from requirements to elicitation and collection. Then it moves to feasibility study. Then it moves to design and prototype. Then it moves to development. Then it moves to testing. Then it moves to deployment and monitoring. The machine learning lifecycle adds the same clarity to machine learning work. It sets instructions and best practices across defined phases. It runs from start to end and then loops again. Each loop feeds lessons back: live scores reshape data pulls, data gaps reshape goals, and goal shifts reshape models.

Think of a restaurant kitchen. Ingredients arrive daily, recipes guide cooking, and the dining room serves guests. A great recipe alone feeds nobody. It needs fresh ingredients each day and a working dining room. Data are the ingredients. The model is the recipe plus the cook's trained skill. Code is the dining room, the staff, and the billing desk. The mapping is direct: stale ingredients spoil the dish, a weak recipe wastes good ingredients, and a closed dining room wastes both. The analogy breaks at one point: ingredients are used once, while data can be reused across many training runs if versioned with care.

Common algorithms used in this cycle include decision tree, random forest, AdaBoost and other boosting methods, k-means, k-nearest neighbours, density based clustering, linear regression, and logistic regression. Each one learns patterns from data through repeated passes. Each pass updates the learned state. Trees split fields step by step. Forests vote across many trees. Boosting fixes past errors round by round. Clustering groups close rows. Regression fits smooth trends.

Picture a circle with six stops around the rim: business goal, problem framing, data processing, model development, deployment, and monitoring. Arrows run clockwise, plus short return arrows jump back from any stop to any earlier stop. The horizontal sweep shows progress from idea to live use. The return arrows show rework. The takeaway in one line: progress moves forward around the ring, while learning flows back through the short arrows.

Scope: This loop fits any system that learns from changing data and serves live users. It assumes fresh data keeps arriving, live feedback can be measured, and retraining is allowed. It breaks for a one-off class notebook that is trained once and never served. Assumption: data, compute, and a deploy target exist. If any one is missing, the loop stalls before it starts.

A common trap is to read the ring as a straight line. Students list the stages in order and stop. The exam rewards the return arrows. A second trap is to equate the model with the product. The model is one asset of three. A third trap is to treat monitoring as optional polish. In this design monitoring is a first-class stage that triggers the next loop.

Recap: machine learning work is an iterative continuous cycle of workloads, not a single training run. Bridge: the next step names the three assets that flow around that ring: data, model, and code.

Real-world link: hospital triage scores, insurance risk scores, and stock trading signals all live inside this loop. A hospital model is retrained as patient mix shifts. A trading model is rechecked as price feeds shift. In both fields the loop, not the single model, is the product that earns trust.

Exam note: the machine learning lifecycle is a top focus area for the exam. Lead every broad answer with machine learning lifecycle stages and iterative continuous flow with feedback loops. Name business goal, problem framing, data processing, development, deployment, and monitoring in order.

16.1.2 Three Assets Every Machine Learning Software Needs

Every machine learning software needs three assets. Without data, machine learning has nothing. The three assets are data, model, and code.

Data (the raw material, such as records, images, text, or sensor streams, often 80 percent of project effort) can be health records, gold prices, stock ticks, images, text, or sensor streams. Model (the learned artifact, namely the trained algorithm plus its weights and settings, for example a random forest file of 50 MB) is the trained algorithm plus its weights and settings. Code (the surrounding software that calls the model, such as an app, service, or legacy suite) is the app, service, or legacy system that uses the model.

Data feeds training. Model holds learned patterns. Code carries scores to users. Lose any one and the system stops: no data means nothing to learn, no model means no learned pattern to reuse, and no code means no path to the user.

A health care example ties the three together. Health records form the data. A trained classifier forms the model. A hospital system, insurance system, or medical record system forms the code base. Hospital insurance trading integration shows the same lesson in three domains: a separate model is useless without code product integration. The pipeline output must join that code base. It may join a mobile app. It may join a web app. It may join an older legacy app. It may join an enterprise resource planning system.

A market example works the same way. Gold price records across regions form the data. A linear regression or logistic regression model forms the model. An intelligent stock trading system forms the code. That system lets a user buy or sell gold. The model alone has no value until it lives inside that system.

Hospital, insurance, medical record, enterprise resource planning, mobile, web, and trading systems all consume models through code integration. That list is worth keeping intact for exam answers that ask where models live in practice.

Exam note: expect a question that asks for the three assets or three levels. Answer with data, model, and code, plus one line on each.

16.1.3 Three Engineering Methods for the Three Assets

Each asset has its own engineering method. Data needs data engineering (the practice that builds the data pipeline: explore, validate, profile, wrangle, clean, split, version, and store). Model needs ML model engineering (the practice that turns algorithms into served models: select, train, tune, evaluate, and serve). Code needs code engineering (the practice that builds the surrounding software: version, build, test, deploy, and monitor with logging).

Data engineering deals with the data pipeline. It explores data. It validates data. It profiles data. It wrangles data. It cleans data. It splits data. It versions data. It stores data.

ML model engineering deals with the model pipeline. It selects algorithms. It trains models. It tunes models. It evaluates models. It serves models. Model as a service is one serving style.

Code engineering deals with the final software pipeline. It uses trunk based development. It versions code. It builds code. It runs integration testing. It deploys code. It monitors code with logging.

The three pipelines are: data pipeline where data engineering happens, machine learning pipeline where algorithms turn into models, and software code pipeline where code is built, integrated, and deployed. Continuous integration and continuous delivery live in the code side. Metadata lives across all three. Hyperparameters and performance parameters live mainly on the model side. Validation strategies live across data and model.

A side-by-side read helps. Data engineering asks if the input is right. Model engineering asks if the learned pattern is strong. Code engineering asks if the product stays up. When all three pass, the release ships. When any one fails, the loop returns to that pipeline instead of patching the wrong place.

Pipeline Main question Typical checks
Data pipeline Is the input sound? profiling, validation, split stability, version tag
Machine learning pipeline Is the pattern strong? train-tune-evaluate scores, holdout gaps, tuning logs
Software code pipeline Does the product stay up? build pass, integration test, deploy switch, log watch

Pick the pipeline by the symptom. Falling input quality points to data. Falling holdout scores with stable input points to model. Errors and downtime with stable scores point to code.

16.1.4 Student Questions and Answers

Q: What are the three important layers in any pipeline — data, model, and code? A: They are data, model, and code. Data is explored and validated. Models are built from training data and then evaluated and packaged. Code takes the packaged model into a product through versioning, build, integration testing, deployment, monitoring, and logging. All three artifacts land in a registry that joins the pipelines, and monitoring feedback returns live issues to data and model.

Several students asked the same layers question in different words, so one canonical answer covers the group.

Q: How do the three separate pipelines join into one lifecycle? A: They join as one bucket. Data artifacts, code artifacts, and model artifacts all go into a registry. The data pipeline feeds the model pipeline. The model pipeline feeds the code pipeline. Monitoring then feeds back to data and model when issues show up. Think of three streams pouring into one tank, with a pump that sends weak batches back to the right stream.

16.2 Data Engineering Pipeline from Ingestion to Splitting

16.2.1 Ingestion, Space, Location, Backup, Privacy, and Catalog

Raw data is the only copy that can rescue a broken pipeline. What five checks must finish before anyone edits a single value? Sources, space, location, get-method, and a backup copy.

Data ingestion (the act of bringing data in from sources, such as files, databases, web feeds, device streams, or vendor feeds, often 10 GB to 10 TB per pull) is the act of bringing data in from sources. Sources can be files, databases, web feeds, device streams, or vendor feeds. Before touching the data, identify the sources. Estimate the space needed. Identify the storage location. Decide how to get the data. Keep a backup or archive copy of the raw data.

The session order was: identify sources, estimate space, identify location, decide the way to get data, and keep a backup copy before working on it. That sequence matters because raw data is the fallback when later steps go wrong. A team that skips the backup has no clean restart when cleaning scripts corrupt a field.

Privacy and compliance start at ingestion, not at the end. Ask which fields hold sensitive facts. Ask which fields can be backed up. Ask which fields can be shared. Check format and consent at the very start. A privacy question may appear as a short-answer item, so link privacy to ingestion in the answer. Health and banking reviews fail fast when a sensitive field was copied to an open bucket on day one.

Metadata (data about data, such as source, format, alias, change date, and read rights, often 15 to 30 fields per dataset) is data about data. Start the catalog at ingestion. Record basic facts for each dataset. Record what the data is. Record where it came from. Record its formats. Record its aliases, meaning other names used for the same field. Record when it was last changed. Record who can read or change it. An access control list, written ACL (the list that states who has read, write, or modify rights, for example 4 analysts read-only plus 2 engineers write), is the list that states who has read, write, or modify rights. Also record source and purpose.

Keep sample test data early. Use a small slice of real data. Or build synthetic data that mimics the real shape. Sampling helps here. A small sample lets the team test the pipeline fast. A 1 percent slice of 1 million rows still gives 10,000 rows to shake out bugs in minutes instead of hours.

Picture a loading dock. Trucks (sources) arrive at marked bays (locations). The dock manager checks dock space, logs each truck's origin and cargo (catalog), locks sensitive crates (privacy and ACL), and photographs the sealed load (backup) before any box is opened. The takeaway: control the dock first, then unpack.

Scope: These ingestion checks fit batch pulls and streaming feeds that land in a lake, warehouse, or lakehouse. They assume source owners grant read rights and that raw retention is legal. Assumption: storage space and consent were confirmed up front. When consent is missing or retention is banned, keep only the catalog entry and a synthetic sample, not the raw copy.

Beginners often start cleaning on the only copy. One bad join then destroys the source of truth. A second trap is to postpone the catalog to the end. Late catalogs miss aliases and access rules. A third trap is to treat privacy as a final filter. Late privacy fixes cannot recall shared copies.

Recap: ingestion means sources, space, location, get-method, backup, privacy check, and catalog entry. Bridge: clean intake leads to exploration, where the team learns what each field really holds.

Backup copies, archive stores, access control lists, and dataset catalogs are standard in regulated domains such as health care and banking. That is the industry anchor for this stage.

Exam note: ingestion plus privacy plus catalog is a likely combined question. Mention backup, sensitive-field check, and catalog fields together.

16.2.2 Exploration, Profiling, Attribute Profiling, and Visual Checks

After ingestion, explore and validate the data. This stage is called exploratory data analysis, written EDA (first-pass plots and stats that catch errors before modeling, often 20 to 40 plots per dataset). It detects errors early. It checks that fields are presentable. It checks that parts fit together. Tools include notebooks such as Google Colab and Jupyter Notebook, visual tools such as RapidMiner and Orange, low-code or no-code automation, and generative AI helpers for quick plots.

Do histogram analysis. Do distribution analysis. Find the minimum. Find the shape. A five-point summary (the five numbers that sketch a numeric field: minimum, first quartile, median, third quartile, and maximum, for example 12, 35, 48, 62, 95) is the five numbers that sketch a numeric field: minimum, first quartile, median, third quartile, and maximum. Here is the first quartile with 25 percent of values below it, is the median with 50 percent below it, and is the third quartile with 75 percent below it. The middle spread is:

where is the interquartile range, is the third quartile value, and is the first quartile value. The session cue was minimum, quartiles, upper and lower quartiles, and where most data spreads. Use the average before the term mean. Use the spread before the term variance. Use middle value before the term median.

Take numbers: if and , then . Values far beyond or earn a closer look as possible outliers. That rule turns a vague spread into a cutoff the team can code.

Attribute profiling (the per-field record, not a customer profile, with about 10 entries per column) is the per-field record, not a customer profile. For each column or field, record name, record count, and data type such as categorical or numerical. For numerical fields add minimum, maximum, average, and median. Add the count of missing values. The missing value ratio was stated as number of absent values over number of records:

where is the missing value ratio, is the count of absent values, and is the total record count. If 40 of 1000 rows lack income, then , or 4 percent. Also record distribution type such as Gaussian, uniform, or binomial, plus source, target, and label role. Label identification means marking which field is the input and which field is the target to predict.

Then visualize. Plot fields. Check correlation, meaning which attribute moves with which other attribute. Correlation guides later feature choices. A scatter of income against loan approval, colored by age band, often shows the split faster than a table of 1000 rows.

Worked example — Class 10 grades with one mistyped average. A class of 10 students has grades: 72, 75, 78, 80, 81, 83, 85, 88, 90, and one wrongly typed 800 instead of 80. The clean sum is 732, so the clean average is . With the typo the sum is 1452, so the wrong average is , which is off the grade scale. Mapping spots the 800 as out of range. Replacement fixes it to 80. Duplicate removal drops any double-entered row. Outlier removal flags values beyond the quartile fence. Sampling reruns the check on a 5-row slice to confirm the fix. Final answer: corrected average 73.2. Sense-check: 73.2 sits inside the 72 to 90 band, while 145.2 does not.

Students often mix a customer profile with attribute profiling. The first describes a person. The second describes a column. Keep the column view here: name, count, type, minimum, maximum, average, median, missing ratio, distribution, source, target, and alias names.

16.2.3 Wrangling, Transformation, and Restructuring

Exploration finds dirt. Wrangling removes it. How does a one-off notebook fix become a step the whole team can rerun every night?

Data wrangling (cleaning and reshaping data for modeling, often 5 to 15 scripted steps) is cleaning and reshaping data for modeling. It includes cleaning, reformatting, and restructuring. It also includes replacing values, normalizing scales, removing or fixing outliers, and dropping irrelevant fields. Write scripts or reusable functions so the steps can run again in a pipeline. That reuse is what turns manual fixes into a transformation stage.

Binning (grouping numeric values into bins, such as 4 to 10 bands) groups numeric values into bins. Common forms are bin by mean, bin by median, bin by mode, and constant value replication. Binning softens noise and outliers. Ages 36, 38, 41, 44, and 45 can share one 36-to-45 bin that the loan model reads as one band instead of five noisy points.

Feature engineering in the broad sense starts here. Drop fields that add no signal. Build derived fields that add signal. A derived field is a new field computed from old fields. Car age is a simple case. If is the current year and is the purchase year, then:

where is the derived car age in years. A 2018 purchase viewed in 2026 gives years. Another case is joining first name and last name into one full-name field.

Restructuring may include these operations: reorder record fields by moving columns, create new record fields by extracting values, combine many record fields into one field, filter datasets by removing record sets, and shift granularity through aggregation and pivots. Aggregation means grouping rows and computing count, maximum, average, or group-by summaries. A pivot reshapes groups into columns. A location-wise total car count is a group-by count aggregation. A custom field in a BI tool such as Power BI is the same idea under a different name.

Worked example — car age plus full-name combine. A sales table holds and first name Ada plus last name Rao. Current year . Car age is years. Full name is first plus a space plus last, giving Ada Rao. A location-wise count then groups 200 rows by city: 80 in one city, 70 in a second, 50 in a third. Final answers: car age 7 years, full name Ada Rao, city counts 80, 70, 50. Sense-check: 7 years fits a 2019 car in 2026, and the city counts sum back to 200.

Power BI custom fields, reusable cleaning functions, and pivot summaries are daily tools in reporting teams. That grounds this stage in tools reviewers know.

A short comparison helps: ETL cleans before loading into the warehouse, while ELT loads raw first and transforms inside the lakehouse. Pick ETL when targets need strict shape on entry. Pick ELT when raw must stay queryable and compute inside the platform is cheap.

16.2.4 Splitting, Validation, and Stability Checks

After wrangling, split the data. Common splits are 80-20, 70-30, and 75-25. The 80-20 rule is the default in many machine learning tasks. Here 80 percent trains the model and 20 percent tests it. Training data builds the model. Test data checks it. A validation slice is often held out for tuning.

The session rule was: 80 for training and 20 for validation and model testing. In symbols, if is the total row count and , then:

where is the training row count and is the test row count. For and , this gives and . For at 75-25, the split is 750 and 250. For at 70-30, the split is 350 and 150.

Remove duplicates before splitting. That order matters. If the same row sits in both train and test, facts from the held-out test leak into training. That leak is called data leakage (test facts leaking into training, often inflating scores by 5 to 15 points). Deduplicate first, then split. Deduplicate before split stops test leakage into training.

Validate splits. Cross-fold validation, probability checks, and the population stability index, written PSI (a drift score across bins, often 0.05 per bin shift as a watch line), were named as methods to spot unstable splits and to steer away from underfit, overfit, and toward best fit. Underfit (model too plain, misses patterns, such as a line fit to a curve) means the model is too plain and misses patterns. Overfit (model memorizes training noise, such as 100 percent train but 70 percent test) means the model memorizes training noise. Best fit (learns patterns that hold on new data, such as 85 percent train and 83 percent test) means it learns patterns that hold on new data. Version the splits and the data so runs can be repeated. Stores named for this purpose include GitHub style version control, metadata stores, and model registries.

Worked example — 1000 rows at 80-20. Start with rows. Drop 20 exact duplicates first, leaving 980 clean rows. Apply : and . Final answers: 784 training rows, 196 test rows. Sense-check: the parts sum to 980, and no duplicate ID appears on both sides because dedup ran before the split.

Picture two overlapping circles for train and test. Leakage is the overlap holding identical rows. Dedup-first pulls the circles apart so the overlap is empty. The takeaway: order creates independence, and independence makes test scores honest.

Scope: Fixed 80-20, 70-30, and 75-25 splits fit IID tables with hundreds or more rows. They assume rows are independent and past mix matches future mix. Assumption: no time order and no group structure. For time series split by date, and for grouped records split by group, or leakage returns through the back door.

Three traps repeat: splitting before dedup, tuning on the test set until it becomes a second training set, and reading a high training score as proof of quality. Track train, validation, and test apart. Let PSI and cross-fold checks warn when the split is unstable.

A motto repeated in the session captures the whole section: garbage in, garbage out. If data work is weak, the pipeline fails later. About 80 percent of machine learning project effort goes to data for this reason. That 80 percent figure is the cost of skipping the steps above.

Exam note: splitting ratios, leakage prevention order, and five-point summary are compact numerical questions. State the 80-20 default with 70-30 and 75-25 options, show the counts for 1000 rows as 800 training and 200 testing, state deduplicate-before-split to stop leakage, and link PSI and cross-fold checks to underfit, overfit, and best fit. Show , five-point summary, and .

16.2.5 Student Questions and Answers

Q: How should metadata be built for each attribute in a data pipeline? A: Build one profile per attribute. Record name, record count, and type. For numbers add minimum, maximum, average, and median. Add missing count and the ratio of absent values to total records. Add distribution type such as Gaussian or uniform. Add source, target, and alias names. This per-attribute profile feeds the five-point summary and later modeling choices, including label role for inputs and targets.

Q: What restructuring moves are allowed on a wide table with many columns? A: Move columns, extract values into new fields, combine fields into one, remove record sets by filtering, and change grain by aggregation or pivot. A 50-column or 200-column wide table can be reordered, trimmed, augmented with derived fields, and then grouped by count, maximum, or average. Each move keeps a scripted step so the wide-table reshape reruns cleanly.

16.3 Problem Framing and Lifecycle Architecture with Feedback Loops

16.3.1 Business Goal, Scope, and Process Stages

Every model starts as a business sentence. What happens when the data cannot support that sentence? The team reframes the problem instead of forcing the model.

Any business project starts with requirements. Define the scope. Define what success looks like. Then collect data. Then process data. Then develop models. Then develop code. Then move to production. Then deploy. Then monitor. Machine learning projects follow the same spine.

The machine learning lifecycle in the session runs: business goal, problem framing in machine learning terms, data processing, model development and deployment, and then ongoing monitoring of model and performance. It is a continuous process. Development and deployment are paired. Monitoring never ends. Data limits force reframing of goals, and that re-explanation return path is part of the design, not a failure.

Phases need not run in strict order. A phase can feed back. A phase can break the flow. A weak model may send work back to data. A data issue may send work back to framing. Deployment does not have to wait for a full loop. Fixes can re-enter at the right point and then move forward again. Treat the lifecycle as a circle with many entry points, not a straight line.

Think of feasibility study as part of framing. Ask if the task can be done. Check four Ms: people power, machine, material, and money. People power means skilled hands. Machine means compute and tools. Material means usable data. Money means budget for storage, compute, and reviews. In software terms this is still called a feasibility study. Good research and deep checks before building save rework later.

A story thread in the session made the same point with a spider, a king in a cave, and a half-built web that kept breaking and being rebuilt. The spider rebuilt its web after each fall while the tiger waited for its chance. The takeaway was plain: when work falls, study, adjust, and try again. A waiting tiger is not gone. It waits for its chance. In project terms: pause, learn, keep resources ready, and re-enter at the right time. Related maxims were: decide with care before acting, then stop second-guessing after the decision, give the best each time from first session to last, stay a fresh learner, and share knowledge. Feasibility with four Ms is the practical form of that story: check people, machine, material, and money before the next attempt.

Picture a ladder with a slide back to the ground. Each rung is a stage from goal to monitoring. The slide is the feedback path. The takeaway: climbing is progress, sliding back to reframe is control.

Scope: This framing fits goal-driven projects with a named owner and a measurable win, such as fewer defaults or faster triage. It assumes goals can be restated in model terms with a clear target field. Assumption: data access and success metrics exist. When neither exists, pause for sourcing and scoping before any modeling.

Two traps show up here. One is to freeze the first problem statement and defend it against data evidence. The other is to skip feasibility and learn about missing machines or missing money mid-build. Both cost weeks. Reframe early and check the four Ms early.

Recap: scope, success metric, feasibility, then looped build and monitor. Bridge: the next step packs that spine into a four-stage architecture teams can draw on one page.

16.3.2 Lifecycle Architecture in Four Stages

The lifecycle architecture groups the three pipelines into one view with four stages: data process, develop model, deploy, and monitor. It was named in the session as the YAMA lifecycle architecture, used here as the lecture label for this four-stage view.

Data process covers ingestion through prepared features. Develop covers training through packaged artifacts. Deploy covers release to an app or endpoint. Monitor covers live checks on data and model health. Stored artifacts let any stage rerun. Data, code, and model versions sit in registries. Real-time inference and batch inference both read from those artifacts. A feedback loop returns live findings to data or model. Active learning uses new labeled feedback to improve the model. Scheduling keeps retraining on track. Alarms flag breaks. Version pull and push restore a known good state.

Four boxes in a ring: data process, develop, deploy, monitor. One return arrow closes the ring from monitor back to data process and develop. Registries sit below the ring and feed every box. That sketch answers most architecture questions on its own.

Draw the four boxes left to right, then curve an arrow from monitor back to data process. Label the forward arrows with artifacts (features, packaged model, endpoint) and the return arrow with feedback and retraining. Add small side boxes for scheduler, alarm, and lineage tracker. The takeaway: forward flow ships value, return flow protects value.

Exam note: draw the four boxes and label the arrows. Data process, develop, deploy, monitor, plus a return arrow for feedback and retraining.

16.3.3 Feedback Loops and Classic Process Models

A good question raised in the session asked for a return path from data analysis back to problem framing. The answer was yes. Data findings can reshape the problem. Data findings reshape framing, and that update must touch catalogs and logs so later runs stay consistent. Limits in data, noise levels, or missing fields can force a change in goals. That change must update logs and catalogs so later runs stay consistent. Isolated step diagrams hide this. Real work needs the loop. The lifecycle is a circle with many entry points: new data, new goals, or new live faults can each restart the ring.

Classic models already include such loops. CRISP-DM (a cross-industry process for data mining with feedback between phases, often 6 phases) is a cross-industry process for data mining with feedback between phases. SEMMA (a sampling, exploring, modifying, modeling, and assessing flow, often 5 steps) is a sampling, exploring, modifying, modeling, and assessing flow. KDD (knowledge discovery in databases, often 5 steps from selection to interpretation) is knowledge discovery in databases. A review paper comparing CRISP-DM, SEMMA, and KDD, including common pitfalls, was pointed to as further reading. Each model has strengths and limits. Each one stresses return paths when results or data force a rethink.

Model Full reading Loop habit
CRISP-DM Cross-industry standard process for data mining business-to-data and model-to-data returns
SEMMA Sample, Explore, Modify, Model, Assess assess-to-modify returns
KDD Knowledge discovery in databases interpretation-to-selection returns

When to pick which: use CRISP-DM language for business-heavy answers, SEMMA for tool-pipeline answers, and KDD for research-style answers. All three agree on one rule: allow the return path.

16.3.4 Lineage Tracking

Lineage (the full journey of data from start to end: source, moves, hands that touched it, often 5 to 20 hops) is the full journey of data from start to end. A lineage tracker (the log that records pedigree: source, moves, and hands that touched data, often auto-captured per run) records that journey. It shows where data came from. It shows where it moved. It shows who changed it. It shows who aggregated it. It shows where shape changed. In database terms this is full auditing.

The session definition was pedigree of data: source, moves, and hands that touched it. Without lineage, trust and transparency drop. A random file and a sourced feed look the same. With lineage, the team sees the source, the transforms, and the confidence behind each field.

Lineage supports data quality, governance, debugging, and compliance. It supports privacy reviews and policy checks. It supports regulatory audits. It supports business intelligence that must cite sources. It answers who changed a field: vendor, hospital, agency, or team member. It answers why field A was mapped to field B. Without lineage we lose the transform history: we cannot say what changed, where it changed, or why a mapping was made, and that hurts trust, transparent reviews, debugging, quality checks, and audits. Automated lineage tools capture much of this. Databricks was named as one platform with lineage support. AI helpers can also track attribute shifts, such as a maximum that jumps after a pattern change.

Picture a parcel label that gains a stamp at every depot: sender, truck, warehouse, repack, delivery van. The takeaway: stamps prove the route, and the route proves trust.

Databricks lineage views and audit logs are used to prove source, change history, and transform logic during reviews. That is the named industry anchor for exam answers.

Exam note: lineage is easy to miss in notes but easy to ask. Define pedigree, list audit uses, and link it to quality, governance, debugging, privacy, and regulatory review with automated capture.

16.3.5 Student Questions and Answers

Q: Should there be a loop back from data preparation to problem framing? A: Yes. Data work often shows that the first framing was off. Data limits, quality gaps, or noise may force a new problem statement and a small shift in business goals. Update the catalog and logs when that happens. Treat the lifecycle as a circle with many entry points, not a straight line. Data findings reshape framing through this return path.

Q: Without lineage, what do we lose from the transform history? A: We lose the transform history. We cannot say what changed, where it changed, or why a mapping was made. That hurts trust, transparent reviews, debugging, quality checks, and audits. Lineage restores the mapping reason and the quality trail for governance and regulatory review.

16.4 Components That Support the Lifecycle

16.4.1 Online and Offline Feature Stores

Training and serving must read the same feature. What shared store stops the classic skew where training saw one value and serving sees another?

A feature (a model-ready input field, such as 30-day spend sum of 12,400) is a model-ready input field. A feature store (the shared store for those fields that feeds training and serving from one place, often 100 to 10,000 features) is the shared store for those fields. It feeds training and serving from one place. One definition, one code path, two readers.

An online feature store holds current feature values for fast lookup. It suits low-latency retrieval at serve time, often single-digit milliseconds per key. An offline feature store holds history of feature values. It suits training and batch scoring. It helps the team study past values and rebuild training sets. Point-in-time joins from the offline side rebuild exactly what was known at each training timestamp, which blocks leakage from future facts.

Online means now for serving. Offline means history for training. Both read from one logic definition so scores match the lab.

A bank example was used. All banking features sit in an enterprise model or metadata store. New products reuse those tested features instead of rebuilding them each time. A 90-day delinquency flag defined once can serve cards, loans, and fraud checks together. The same pattern fits retail, logistics, health, and telecom: define once, reuse often, monitor in one place.

Store Holds Serves Speed need
Online current values live scoring milliseconds
Offline full history training and batch throughput over latency

When to pick which: live requests read online, nightly jobs and training read offline, and both cite the same feature name and version.

16.4.2 Model Registry

A model registry (the store for machine learning model artifacts plus linked data snapshot, code version, and model type, often 10 to 500 versions) is the store for machine learning model artifacts. It holds trained models plus linked metadata such as data snapshot, code version, and model type. It acts like version control for models.

A team may try an ensemble, a random forest, and one more method side by side. The winning model is saved. In Python that save is often a pickle file or model file. The registry records which data and which code made that file. Last week built a model and saved it. Next time metrics dip, the team can open the registry, compare the past model, and see what changed in data or code. That compare is the fastest debug path when live scores fall without a code deploy.

Picture a library shelf where each book (model file) carries a card listing its sources (data snapshot), its printer (code version), and its edition (model type). The takeaway: the card matters as much as the book, because the card lets any past model be tracked and restored.

Scope: Registries fit teams that ship more than one model version and must roll back. They assume data snapshots and code tags are stored alongside the file. Assumption: version discipline holds. Without linked metadata the registry degrades into a folder of mystery files.

16.4.3 Feedback Loop, Alarm Manager, Scheduler, Retraining, and Recovery Aims

A feedback loop (live performance check that returns findings to data or features, often hourly or daily) checks live performance and returns findings. It uses evaluation scores and drift checks. Model drift (the gap between training behavior and live behavior, such as accuracy 92 percent in lab but 81 percent live) is the gap between training behavior and live behavior. Data drift means input shape moved. Model drift means output quality moved. When production scores fall, the loop triggers fixes in data or features.

An alarm manager (the watcher that runs on a schedule and sends alerts to owners, often within minutes) is the watcher. It runs on a schedule. It checks triggers across the pipeline. It sends alerts to owners when data breaks, quality falls, or speed drops. A scheduler (the clock that runs timed jobs such as nightly retraining or batch scoring) runs timed jobs such as nightly retraining, batch scoring, or report builds. A retraining pipeline (the rerun path for training when drift crosses a limit or fresh data lands) reruns training when told to, for example when drift crosses a limit or when fresh data lands. Feature stores, registry, scheduler, alarm, feedback, retraining, and lineage form one support ring around the four stages.

A lineage tracker also helps recovery. It lets the team rebuild the exact setup at a past point. Two recovery terms were linked here. Recovery point objective, written RPO (the point in time to restore to, namely how much past work the team can afford to lose), is how much past work the team can afford to lose. Recovery time objective, written RTO (how long restoration may take, namely how fast the team must restore service), is how fast the team must restore service. Keep both terms with any recovery question and state the version being restored. In short: RPO sets the loss limit, RTO sets the clock limit.

Take numbers: an RPO of 1 hour means at most 1 hour of new labels may be lost. An RTO of 4 hours means service must be back within 4 hours using the last good snapshot, code tag, and model file from the registry and lineage log.

Beginners mix the two aims. RPO is about data loss measured in time. RTO is about downtime measured in time. A second trap is to page humans for every drift wiggle. Set alarm limits from SLOs so only real breaks wake owners.

Recap: stores hold features, the registry holds models, and the loop plus alarm plus scheduler plus retraining plus lineage keeps them healthy and restorable. Bridge: healthy parts now feed model development, where algorithms turn into scored artifacts.

16.4.4 Student Questions and Answers

Q: What is the split between stages and components in the lifecycle architecture? A: Stages are the process steps: data processing, preparation, training, testing, deployment, and monitoring. Components are the supports that make those steps run well: online and offline feature stores, model registry, scheduler, alarm or monitoring program, feedback loop, retraining path, and lineage tracker. The red-dot items on the architecture view were those components. Stages move work forward while components keep it safe and repeatable.

Q: What is a model registry in one line? A: It is a store for trained models plus linked data, code, and model metadata, with version control and lineage so any past model can be tracked and restored. Think shelf plus index card: the file plus the proof of how it was built.

16.5 Model Development and Explainable AI

16.5.1 Train, Tune, Evaluate, and Package

Data is clean and split. How does the team turn rows into a model reviewers can trust enough to ship?

Model development starts after data quality is in place. The loop is train, tune, and evaluate. Train means fit an algorithm on training data. Tune means adjust settings. Evaluate means score on held-out data. Then package the result as code plus artifact.

Code here is not the final production app code. It is training and test code, often in Python or R. Features are selected. One algorithm or many algorithms are tried. An ensemble (a blend of many models into one stronger model, such as 200 trees voting) blends many models into one stronger model. Training and tuning can run in parallel with data pulls. Visual checks and debugging run alongside. Bottlenecks, overfit, and wrong activation choices are fixed before packaging.

A pre-production path can run as CI, CD, and CT. Continuous integration (merging and checking code often, often per commit) merges and checks code often. Continuous delivery (shipping tested builds often, often daily) ships tested builds often. Continuous training (retraining models often, often nightly or on drift) retrains models often. Data preparation pipelines, online and offline feature loads, build-train-release steps, and deploy-test steps all fit in that chain. A pipeline is a linked series of steps run in order with checks at each step.

Evaluation uses holdout sets. Right sets and wrong sets are compared. Models are retrained. Results are scored again until the best stable model remains. A golden holdout that models never train on guards this step: scores on that sealed set reveal sudden quality drops that tuned validation scores hide.

Picture an assembly line with three stations and a reject chute after each station. Train builds, tune adjusts, evaluate scores, and weak builds slide off the line. The takeaway: only stable builds reach packaging.

Scope: This loop fits supervised tables, images, and text with labeled holdouts. It assumes train, validation, and test stay apart. Assumption: seeds and versions are fixed so reruns match. Without sealed holdouts and fixed seeds, tuning leaks into testing and scores mislead.

16.5.2 Algorithm Choice and Notes on Python and R

Choose algorithms that fit the data shape and goal. Linear models suit smooth trends. Tree ensembles suit mixed tables. Neural nets suit images, speech, and large text. Try more than one. Compare on the same splits. Keep the simplest model that meets the goal.

R and Python both work. R was praised for stats, plots, and data-frame views. RStudio shows data changes, color shifts, and distributions in a direct way that speeds debugging and profiling. That strength showed in finance work and in stats-heavy models. Python was praised for breadth of packages and serving paths. Use either. Keep runs repeatable with fixed seeds and saved versions.

Goal First try Why
smooth price trend linear regression direct slope plus offset read
mixed loan table random forest handles mixed types and gaps
retina image convolutional net learns edges and textures

When to pick which: start simple, compare on one shared split, and move up in complexity only when the simple model misses the target by a clear margin.

16.5.3 Explainable AI and Fairness Aims

Models are often black boxes. A team can run a model yet not know why it chose a value. Explainable AI, written XAI (methods that show which features pushed a decision and by how much, such as SHAP and LIME), opens that box a little. It shows which features pushed a decision and by how much. It supports reliability, trust, usability, fairness, privacy care, and harm reduction. It helps spot data bias, model bias, and social bias. Interpretability is the key term: can a person read why the model acted? Black box to white box through LIME and SHAP with loan and gold intuition is the running thread of this section.

Named XAI techniques include SHAP, LIME, partial dependence plots, and individual conditional expectation plots. SHAP is a Python package based on game-theory shares. LIME is a package that explains one prediction at a time by testing small changes nearby. Partial dependence shows the average effect of one feature. Individual conditional expectation shows that effect per row. Google and open-source groups both ship such tools. Industry trend notes SHAP as the gold standard for interpretability while LIME stays popular for fast local reads.

Scores hide reasons. LIME shows why one case got its label by testing nearby variants. SHAP shows each feature share in the final number. Both expose weak drivers, biased drivers, and drivers to drop. That turns a black box into a more white box that reviewers can trust.

Finance, health, retail pricing, and vision teams use SHAP or LIME to defend a decision to reviewers, buyers, or care teams. A loan officer, a care team, or a buyer can read the chart without opening model code.

Exam note: an examiner may ask how to turn a black box into a more white box. Answer with XAI, name SHAP and LIME, and sketch one worked case with numbers.

16.5.4 Worked Examples with LIME and SHAP

Example 1: loan approval with a random forest and LIME. The task is to predict approved or not approved. The model is a random forest classifier. The data is split with 25 percent held for testing, so if is the row count:

where is the test row count and is the training row count. For , and . Randomization fixes the split so reruns match. This 25 percent test split for the random forest loan approval case is the backbone number to quote.

Worked example — loan approval, random forest plus LIME. Inputs are income 50000, age 45, and credit score 650. The model output was stated as not approved with probability 0.37 and approved with probability 0.63:

where is the input row of income, age, and credit score, and is predicted probability. Note , so the two shares cover all outcomes. LIME tests many small combos near the case and reports which ranges pushed the result. Stated ranges were credit 610 to 710, age 36 to 45, and income near 40000 and above. Charts show which band added weight and which band cut weight. Final answers: approved 0.63, not approved 0.37, top bands credit 610 to 710 and age 36 to 45. Sense-check: a mid credit score with solid income landing just above 0.50 reads as a close approve, which matches the 0.63 value.

Example 2: gold price with linear regression and SHAP. The base shape is a line:

where is the predicted gold price, is the slope rate, is the input driver, and is the base offset. The session cue was exactly this plain form, y equals m x plus c. Drivers named were stock market index, inflation rate, interest rate, oil price, and US dollar index. Take numbers: if per index point, , and , then .

SHAP then splits credit for one prediction across drivers. The run showed mean absolute share per feature. The US dollar index had the largest mean absolute value. The summary plot shows impact direction on the horizontal axis and feature value on the right side. It also shows which drivers add little and can be dropped. That ranking is the pruning guide: keep top drivers, drop flat ones.

Worked example — gold price SHAP waterfall from base 1483.83. One waterfall case was walked through. The base value was about 1483.83. The final output was near 1499. Stated pushes were about plus 10 from inflation, plus 8.33 from one driver, plus 0.83 from another, and minus 2.5 from the US dollar index term. In additive form:

where is the final prediction, is the base value near 1483.83, and each signed term is one feature share. Step sum: , plus 8.33 gives 1502.16, plus 0.83 gives 1502.99, minus 2.5 gives 1500.49, with small remaining shares landing near 1499. Final answers: base 1483.83, final near 1499, US dollar index top driver by mean absolute share. Sense-check: a 15-point net move on a 1483 base is about 1 percent, which fits a calm gold day driven by mixed macro pulls.

Extra cases used the same lens. A medicine recommendation case used profiling plus physical traits with LIME color maps. An eye retina case used LIME to mark color, thickness, and edges that drove detection. Vision work with neural nets, convolutional nets, and OpenCV benefits most because those models hide the most. For vision the model hides edges, colors, and shapes it used, and LIME maps mark the exact zones that pushed the call, which is why retina and recommendation cases used it.

Picture a stacked bar that starts at 1483.83 and gains green blocks upward and one red block downward to land near 1499. The horizontal axis is price impact. Each block is labeled by driver. The takeaway: low to high moves can be read driver by driver, including where a driver adds, where it cuts, and where it adds nothing.

16.5.5 Metrics, Settings, Visualization, and Debugging

Score models with more than one number. Accuracy is share correct. Precision is share true among predicted true. Absolute error is gap size per row. Root mean square error punishes large gaps more. A confusion matrix splits right and wrong by class. Pick metrics that fit the goal. A trading model and a care model do not share the same cost of error. Take numbers: 90 correct of 100 gives accuracy . If 80 rows are predicted true and 60 are truly true, precision is .

Tune hyperparameters (settings set before training, such as epoch count of 50, hidden layer count of 3, learning rate of 0.01, and error target of 0.001), meaning settings set before training. Examples are epoch count, hidden layer count, learning rate, and error target. Learning rate, written (the step size per update, such as 0.01), is the step size per update:

where is the current weight, is the gradient direction for that step, is the learning rate step size, and is the updated weight. The session point was: learning rate and error rate guide tuning alongside epochs and layers. Small steps learn slow and steady. Large steps learn fast but can overshoot. Take numbers: if , , and , then .

Watch activations in neural nets. Choices include sigmoid, tanh, ReLU, and softmax. Each shapes how signals pass. Wrong choice can stall learning or skew scores. Visualize curves, debug bottlenecks, check overfit, and only then freeze training code and artifacts.

Scope: These metrics and settings fit batch-trained models with clean holdouts. They assume error costs are known per domain. Assumption: validation mirrors live mix. When live mix drifts, retune metrics and limits rather than trusting frozen lab wins.

Common traps: tuning to one metric while ignoring cost of error, raising epochs until training hits 100 percent while test falls, and setting the learning rate so high that weights bounce. Track train and holdout together and stop when the holdout gap widens.

Recap: train, tune on validation, score on sealed test, explain with LIME and SHAP, then package. Bridge: a packaged model still needs a safe path to users, which is deployment.

16.5.6 Student Questions and Answers

Q: Why use LIME or SHAP when the model already scores well and gives reasons by accuracy? A: Scores hide reasons. LIME shows why one case got its label by testing nearby variants around that case. SHAP shows each feature share in the final number, such as plus 10 or minus 2.5 on gold. Both expose weak drivers, biased drivers, and drivers to drop. That turns a black box into a more white box that reviewers can trust for fairness and safety.

Q: Do these tools help neural nets and images for vision tasks too? A: Yes, often more. For vision tasks the model hides edges, colors, and shapes it used. LIME maps can mark the exact zones that pushed the call, such as color, thickness, and edges in a retina scan. That is why retina and medicine recommendation cases used it: hidden vision cues become visible zones a care team can check.

16.6 Deployment and Inference Pipeline

16.6.1 Endpoint Production, Containers, Sandbox, and Calling Style

The model scores well in the lab. Why not paste its code straight into the main app? Because one bad push can take down every user at once.

Deployment moves a tested model into live use. Inputs needed at serve time are features, model artifact from the registry, and inference code. Inference is the live scoring step. A container holds that step apart from the main app. A sandbox holds a trial release apart from production. That isolation cuts risk. A separate endpoint, container, or sandbox limits blast radius while traffic shifts in steps and rollback stays simple.

The serving pattern is simple. Send a request to an endpoint. Run the model. Return the result. A message bus queue can carry the request in and out. The team does not paste all machine learning code into the main codebase. It keeps scoring as a separate stream with a small interface. A Java interface analogy was used: define the method once in an interface, run the logic elsewhere, call it when needed. Remote calls such as remote procedure call and remote method invocation follow the same call-and-return shape.

Keep scoring as a separate stream: endpoint in, model run, result out. The main app calls the stream and never absorbs its code. Queues, containers, and sandboxes enforce that split.

A hardware analogy was used for the same idea. Older laptops had one main board. Newer ones add a small daughter board for add-ons. Fixes and swaps happen on the small board. The costly main board stays safe. Deployment isolation works the same way. Daughter board small swaps protect the costly main board, and deployment isolation does the same for software. Small scored service changes fast. Core product stays stable.

Picture a house with a fuse box beside the main wiring. New circuits are tested in the side box first. The takeaway: trial power flows apart from house power until proven safe.

Scope: Endpoint plus container plus sandbox fits request-response scoring and queued batch scoring. It assumes the model file, feature code, and interface versions match. Assumption: monitoring watches the new path alone. Without that split watch, a failing shadow looks like a healthy product.

16.6.2 Blue-Green Deployment

Blue-green deployment (two same production setups with a traffic switch, often 2 live stacks) keeps two same production setups. Blue is the live setup. Green is the matching setup for testing. Steps are: build green to match blue, test the new model and code on green, move live traffic from blue to green when tests pass, then swap roles so green becomes live and blue becomes standby.

Twin setups with a traffic switch mean blue-green. Build the twin, prove the twin, flip the switch, keep the old twin as instant rollback.

The stated reason is less downtime and less risk when a new or changed version ships. Machine learning code must not break regular production. The switch makes rollback fast because the old side still exists. If green misbehaves under real load, traffic flips back to blue in minutes.

Picture two identical stages side by side with one spotlight. The spotlight is live traffic. Moving the spotlight is the deploy. The takeaway: the show never goes dark during the move.

A short cost note: twins cost double capacity during the switch window. That price buys near-zero downtime and a one-step rollback, which is cheap against a full outage.

16.6.3 Canary, A/B, and Shadow Deployment

Canary deployment (new release to a small user group first, often 1 to 5 percent) sends a new release to a small user group first. Others stay on the old version. When the small group shows good results, roll out bit by bit to more users. A version 1.6 trial on a few accounts, then a wider phased rollout, is the classic shape. Use canary when architects must test a machine learning choice without touching most users. Canary is a safety check on a few users with quick promotion.

A/B testing (split traffic between old and new models by rule, often 50-50 for days or weeks) splits traffic between old and new models by rule. Some tenants or customers go to the changed code. The rest stay on the old code. It looks like canary but often runs with a larger group and a longer window, often days or weeks. A new mobile cohort using the AI path while older cohorts stay put is one setup. Use it to compare models on live traffic over time. Pick A/B for a longer split with more users to compare old and new models over time.

Shadow deployment (new version runs next to old on live-like load but serves no production answers) runs the new version next to the old version. Both see live-like load. Only the old version serves production answers. The new version runs in shadow while the team tests, studies, and monitors. Internal reviewers watch logs and gaps. When trust is high, promote the shadow to live. Use shadow when silent proof is needed before any user sees new answers. Silent side run points to shadow.

Strategy Shape Use when
Blue-green twin setups with switch downtime must stay near zero
Canary small group first, here version 1.6 trial first safety check, quick promote
A/B split traffic by tenant or cohort for days or weeks compare old versus new over time
Shadow silent side run, old serves need silent proof before exposure

When to pick which: small-group trial points to canary, split traffic over days or weeks points to A/B, silent side run points to shadow, and twin setups with a traffic switch point to blue-green. Add downtime and risk as the reason for all four.

Phased app rollouts, tenant-split model tests, and silent shadow scoring are standard release controls in product teams. That is the industry anchor for this stage.

Traps to avoid: promoting a canary on too few users to trust, ending an A/B test early at the first lucky day, and letting a shadow drift from live shape until its proof means nothing. Fix sample size, window, and input parity before reading results.

Recap: isolate first, then pick the switch: blue-green for instant swap, canary for small-group safety, A/B for measured split, shadow for silent proof. Bridge: live paths now need live eyes, which is observability.

Exam note: deployment strategy questions are often scenario based. Small-group trial points to canary. Split traffic over days or weeks points to A/B. Silent side run points to shadow. Twin setups with a traffic switch point to blue-green. Name downtime and risk in each answer.

16.6.4 Student Questions and Answers

Q: Why not put the model straight into the main app and risk downtime for all users? A: Direct merge risks downtime for all users. A separate endpoint, container, or sandbox limits blast radius. Traffic can shift in steps. Rollback stays simple. Monitoring can watch the new path alone. Isolation is the price of safe speed.

Q: When should the team pick canary over A/B testing for a traffic split? A: Pick canary for a first safety check on a few users with quick promotion, such as a version 1.6 trial on a few accounts. Pick A/B for a longer split with more users to compare old and new models over time, such as tenant or cohort splits run for days or weeks. Canary asks if it is safe. A/B asks which is better.

16.7 Observability for Data, Model, and Language Model Pipelines

16.7.1 Data Observability Pipeline

Pipelines fail quietly first. What early signals show a pipe is clogging before users see bad scores?

Observability (the ability to see and judge pipeline health while it runs, often 5 to 15 live signals) is the ability to see and judge pipeline health while it runs. At ingestion, watch flow control, meaning how data moves from legacy sources to target stores through extract, transform, and load steps. Watch cardinality, meaning how many distinct values flow. Watch volume from many sources. Watch how streams aggregate.

Controls named for this stage include cardinality limiter, concurrency limiter, and aggregator. A cardinality limit such as top 5 or top 10 trims runaway distinct values during queries. If a device field jumps from 200 distinct IDs to 50,000 overnight, the limiter caps the blowup while owners check the source. A concurrency limit caps parallel streams. An aggregator groups streams before deeper steps. Data tiering splits storage by heat. Hot physical storage holds live fast data. Cold tiers hold less-used data. Sampling choices matter too. Full-resolution history keeps all detail. Downsampled views keep speed. A separate query path with access tokens keeps ad hoc reads from harming flows. Flow control with cardinality, volume, aggregation, tiering, sampling, and token-gated queries keeps the pipe stable.

Watch the pipe, not just the model: flow rate, distinct count, volume by source, grouped load, tier heat, sample grain, and query isolation. Limits on cardinality and concurrency plus grouped aggregation hold the line.

After ingest, data quality checks reuse data engineering rules: schema fit, missing values, stats, and outlier shape. Logs from each step feed one view so breaks can be traced fast. Picture a control room wall with one dial per stage: intake rate, distinct count, null share, and late-arrival lag. The takeaway: one wall shows where the pipe bends before it breaks.

16.7.2 Service Indicators, Objectives, and Agreements

Three service terms set pipeline promises. Service level indicator, written SLI (the measured health fact, such as 97 percent fresh), is the measured health fact. Service level objective, written SLO (the target the team sets, such as at least 99 percent fresh), is the target the team sets. Service level agreement, written SLA (the promise made to users, often with a tolerance such as 99 percent against data loss), is the promise made to users, often with a tolerance.

Health facts include freshness share, null share, blank share, and out-of-range share. Stated examples were 100 percent fresh, 50 percent fresh, zero nulls, zero blanks, and zero out-of-range values for customer data. A target example was cap duplicate user IDs at 25 percent. An agreement example was 99 percent tolerance against data loss. In symbols, if is the bad-row count and is total rows, then:

where is the bad share used as an indicator. The team then sets an objective such as for duplicates and an agreement such as kept share . Take numbers: 250 duplicate IDs in 1000 rows gives , exactly at the 25 percent cap. Kept share is then for that slice, while the loss agreement targets 0.99 kept across the full feed.

Indicator is what is measured. Objective is what is wanted. Agreement is what is promised. One number each keeps the promise testable: SLI measured fact, SLO target, SLA promise.

Picture a speedometer (SLI), a speed-limit sign (SLO), and a delivery contract (SLA). The takeaway: the dial shows now, the sign sets the aim, and the contract sets the penalty for missing it.

Exam note: define all three terms and give one number for each. Indicator is what is measured. Objective is what is wanted. Agreement is what is promised.

16.7.3 Model and Language Model Observability

Model monitoring tracks scores, metadata, and store use for governance. It watches training versus live gaps. It triggers automation to retrain, re-evaluate, and redeploy. That loop links back to schedulers and registries. PSI, KL drift scores, golden-set checks, and canary metrics from the companion guides all feed this loop: when input mix or output quality moves past its SLO, the alarm fires and the retraining path takes over.

Language model stacks add three more watch items. Vector drift (shift in embedding vectors when data or model changes, such as mean cosine shift 0.12) is shift in embedding vectors when data or model changes. Prompt drift (shift in output when prompts or context change, such as win rate down 8 points after a template edit) is shift in output when prompts or context change. Full traces (linked chain from user input through prompt text, retrieved chunks, augmented context, to final output) link each answer back through user input, prompt text, retrieved chunks, augmented context, and final output. That chain shows where a bad answer started. Retrieval plus augmentation plus generation must be traced as one path. Vector drift from embeddings, prompt and context drift, and end-to-end traces from input to prompt to retrieval to augmentation to output pinpoint whether the fault sits in data, model, prompt, or retrieved context.

Scope: This stack fits retrieval-augmented products with embedding stores, prompt logs, and drift dashboards. It assumes traces carry IDs across input, retrieval, augmentation, and output. Assumption: golden queries and SLOs exist per use case. Without traced IDs and golden sets, drift alerts cannot name the faulty link.

Three traps: watching only accuracy while embeddings drift silently, editing prompts without version tags so drift has no baseline, and logging outputs without inputs and retrieved chunks so traces dead-end. Version prompts, store embeddings, and trace the full input-to-output path.

Embedding stores, prompt logs, retrieval traces, and drift dashboards are now routine in language model products. That is the industry anchor for this stage.

Recap: data pipes need flow and quality eyes, services need SLI, SLO, and SLA numbers, and language stacks add vector drift, prompt drift, and full traces. Bridge: the appendices now compress these rules into exam lines and industry anchors.

16.7.4 Student Questions and Answers

Q: What should be watched during ingestion for observability of flow? A: Watch flow control, cardinality, volume, stream aggregation, tier use, sampling choice, and query load. Limits on cardinality and concurrency plus grouped aggregation keep the pipe stable. Tiering by heat, downsampled views for speed, and token-gated queries keep reads safe while full traces preserve detail where needed.

Q: How does language model observability differ from plain model monitoring? A: It adds vector drift from embeddings, prompt and context drift, and end-to-end traces from input to prompt to retrieval to augmentation to output. Plain monitoring tracks scores and gaps. Language stacks also track embedding shift, prompt-template shift, retrieval quality, and the full trace chain. Those three pinpoint whether the fault sits in data, model, prompt, or retrieved context.

Exam Guidance Summary

Exam note: lead with the machine learning lifecycle in every broad answer. Name business goal, problem framing, data processing, development, deployment, and monitoring. Stress iterative and continuous flow with feedback loops. Draw the four boxes of data process, develop, deploy, and monitor with a return arrow for feedback and retraining.

Exam note: memorize the three assets as data, model, and code, and the three methods as data engineering, ML model engineering, and code engineering. Use the health and gold cases as one-line examples. Hospital insurance trading integration shows a separate model is useless without code product integration.

Exam note: ingestion answers should bundle sources, space estimate, location, get method, backup copy, privacy check, and catalog fields including aliases and access control list. Link privacy to ingestion and keep a raw backup before edits.

Exam note: attribute profiling answers should list name, record count, type, minimum, maximum, average, median, missing count and ratio, distribution type, and label role. Show , five-point summary with minimum, , median, , and maximum, and . Work the Class 10 grades case and the 80-20 split counts for 1000 rows as 800 training and 200 testing.

Exam note: splitting answers should state 80-20 as default plus 70-30 and 75-25 options, show counts, and state deduplicate-before-split to stop leakage. Link PSI and cross-fold checks to underfit, overfit, and best fit. State garbage in, garbage out with about 80 percent effort on data.

Exam note: ETL versus ELT, catalog versus lake versus warehouse versus lakehouse, and bronze-silver-gold tiers may appear as short compare items. Read ETL as clean before load and ELT as load raw then transform inside. Read bronze as raw intake, silver as cleaned and validated, and gold as curated and aggregated for serving.

Exam note: lineage tracker questions should define pedigree as source, moves, and hands that touched data, list audit uses, and link to quality, governance, debugging, privacy, and regulatory review. Name automated capture including Databricks style lineage.

Exam note: component questions should split stages from components. Stages are process steps: data processing, preparation, training, testing, deployment, and monitoring. Components are online and offline feature stores, model registry, feedback loop, alarm manager, scheduler, retraining path, and lineage tracker. Link RPO to the point-in-time loss limit and RTO to the restore-time clock limit, and state the version being restored for any point-in-time rebuild.

Exam note: XAI is a likely examiner probe. Name LIME and SHAP plus partial dependence and individual conditional expectation. Retell the loan case with 0.63 approved and 0.37 not approved across credit 610 to 710 and age 36 to 45, and the gold case with base near 1483.83 and US dollar index as top driver. Stress black box to white box with feature shares.

Exam note: deployment scenarios map to four names. Twin setups with switch mean blue-green. Small-group first release such as version 1.6 trial means canary. Long split by tenant or cohort over days or weeks means A/B. Silent side run means shadow. Add downtime and risk as the reason for all four, with daughter board isolation as the memory hook.

Exam note: observability answers should define SLI as measured fact, SLO as target, and SLA as promise, each with a number such as capped at 0.25 for duplicates and 0.99 kept for the loss agreement. Add vector drift, prompt drift, and full input-to-output traces for language model items, with cardinality, tiering, sampling, and token controls for ingestion.

Exam note: writing advice repeated in the session: read each question at least twice, link key terms to the lifecycle, draw the pipeline or deployment sketch, give a worked example with numbers, show steps in a table where grading is easier, write assumptions in direct words, and avoid pasted text without added thought.

Key Industry Applications

Health record, insurance claim, and medical record systems embed models for triage, risk scoring, and billing checks under privacy controls. Catalogs, access control lists, and lineage proofs carry the audit load.

Enterprise resource planning, mobile apps, web apps, and legacy suites consume models through versioned endpoints and containers. Daughter board isolation keeps the core product stable while scored services change fast.

Trading desks use linear and logistic models on regional price feeds for buy and sell signals, with SHAP shares to defend each call. A gold base near 1483.83 with driver-by-driver pushes is the template reviewers expect.

Banks reuse enterprise feature stores and metadata stores for fast scoring and for new product builds. Online stores serve now, offline stores rebuild training history, and the registry tracks each version.

BI teams use Power BI custom fields, pivots, group-by counts, maxima, and averages to reshape wide tables. Reusable cleaning scripts turn one-off fixes into nightly steps.

Data teams run Google Colab, Jupyter Notebook, RapidMiner, Orange, low-code visual builders, and generative AI helpers for EDA and profiling. Five-point summaries, , and guide those checks.

Platform teams use GitHub style versioning, model registries with pickle saves, Databricks style lineage, message-bus queues, remote calls, and scheduled retraining with alarm managers. RPO sets the loss limit and RTO sets the clock for restores.

Product teams release with blue-green switches, canary cohorts such as a version 1.6 trial, A/B splits by tenant over days or weeks, and shadow runs to cut downtime and risk. CRISP-DM, SEMMA, and KDD loops frame the process story behind those releases.

Language model products monitor embedding vector drift, prompt drift, retrieval quality, and full traces from input to output. Drift dashboards link each answer back through prompt text and retrieved chunks to its source.

DMML Lecture 16 notes · Machine Learning Lifecycle, Data Pipelines, and Deployment

Data Management for Machine Learning· postgraduate· 2026-09-15

Sections Breakdown

116.1 Iterative Lifecycle and Three Levels of Machine Learning Software

Iterative continuous ML lifecycle with three assets data model code and three engineering pipelines

216.2 Data Engineering Pipeline from Ingestion to Splitting

Data engineering pipeline: ingestion backup privacy catalog, EDA five-point summary, wrangling, dedup-before-split

316.3 Problem Framing and Lifecycle Architecture with Feedback Loops

Problem framing with four Ms, four-stage lifecycle architecture, CRISP-DM SEMMA KDD loops, lineage pedigree

416.4 Components That Support the Lifecycle

Lifecycle supports: online offline feature stores, model registry, feedback alarm scheduler retraining, RPO RTO recovery

516.5 Model Development and Explainable AI

Model development train tune evaluate package; XAI with LIME loan 0.63 and SHAP gold base 1483.83; metrics and lr tuning

616.6 Deployment and Inference Pipeline

Deployment via isolated endpoints containers sandbox; blue-green canary A/B shadow strategies

716.7 Observability for Data, Model, and Language Model Pipelines

Observability: flow cardinality tiering controls, SLI SLO SLA promises, vector prompt drift and full LLM traces

Postgraduate students studying Data Management for Machine Learning

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

Iterative Lifecycle and Three Levels of Machine Learning Software

Must-know: ML work is an iterative continuous cycle over three assets: data, model, code

Top pitfall: Equating the model with the product; treating lifecycle as a straight line

Self-check: Name the three assets and their three engineering methods

Connects to: 16.2, 16.3

Data Engineering Pipeline from Ingestion to Splitting

Must-know: Ingest with backup privacy catalog, profile with five-point summary, dedup before 80-20 split

Top pitfall: Splitting before dedup causes leakage; tuning on test set

Self-check: For 1000 rows at 80-20, how many train and test? Why dedup first?

Connects to: 16.1, 16.3

Problem Framing and Lifecycle Architecture with Feedback Loops

Must-know: Four-stage YAMA ring with feedback loops; lineage pedigree enables audit and trust

Top pitfall: Freezing first problem statement; skipping lineage until audit

Self-check: Draw four lifecycle boxes plus return arrow; define lineage pedigree

Connects to: 16.1, 16.2, 16.4

Components That Support the Lifecycle

Must-know: Online serves now, offline trains history; registry plus alarm scheduler retraining lineage; RPO loss, RTO clock

Top pitfall: Mixing RPO loss limit with RTO clock limit; registry without linked metadata

Self-check: Online vs offline store? RPO vs RTO in one line each?

Connects to: 16.3, 16.5

Model Development and Explainable AI

Must-know: Train tune evaluate with CI CD CT; loan 0.63 vs 0.37 via LIME; gold base 1483.83 via SHAP; lr update rule

Top pitfall: Tuning to one metric; trusting scores without LIME SHAP reason checks

Self-check: Retell loan and gold XAI cases with numbers; write lr update

Connects to: 16.4, 16.6

Deployment and Inference Pipeline

Must-know: Isolate scoring; blue-green twins, canary small group, A/B split over time, shadow silent proof

Top pitfall: Promoting canary on too few users; ending A/B early; shadow drifting from live shape

Self-check: Map scenario to blue-green canary A/B shadow in one line each

Connects to: 16.5, 16.7

Observability for Data, Model, and Language Model Pipelines

Must-know: Data pipe eyes plus SLI measured SLO target SLA promise; LLM adds vector prompt drift and full traces

Top pitfall: Watching accuracy while embeddings drift; prompts without versions; logs without traces

Self-check: Define SLI SLO SLA with a number; name three LLM watch items

Connects to: 16.6, 16.2

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.