ML7: Responsible AI: fairness, explanations, privacy and security

Lesson 3 of 5 · reading 15–25 minutes; practice and project time is on the module page

Privacy in machine learning

🎯You'll be able to

Keep personal data out of features, logs and documents where it isn't needed, and explain the basic duties of data protection law in India.

🏠The everyday picture

A tailor needs your measurements, not your bank statement. Collecting only what the job needs, and keeping it safe, is the start of respecting people's privacy.

📘What it really is

📝A worked example

Input: the starter kit's API, which accepts any JSON and writes the whole request to logs/predictions.jsonl.

Steps:

  1. Send a request that includes "customer_phone": "+91 00000 00001". The starter logs it, phone number and all.
  2. In the reference solution, the API's input schema forbids extra fields, so the same request gets 422 (rejected), and the log lines contain only the booking features, the probability, the model version and a request id.
  3. Project 2's test 8 checks that customer_phone and customer_name never appear in the log.

Expected outcome: the model gets what it needs and nothing else, and a leaked log reveals no customer's contact details.

🌍Where it's used

📝Case scenario

A team debugging a chatbot copied a week of real conversations, with customers' addresses and order details, into a shared spreadsheet. It was later shared with a contractor. The fix was a logging policy: mask personal details at the point of logging, keep logs for a set period, and give access only to named people.

🖱️Try it

List every place in the DakDost kit where a customer's phone number appears (files, columns, logs, documents). Success: you find raw/shipments.csv, the internal page in docs/internal/ and, in the starter, the prediction log; and you write how each is protected in the reference design.

⚠️Common mistakes

🛠️For your project

Project 2's tests 4 and 8 check that the API rejects a phone number and never logs one; Project 3's test 6 checks that staff contact numbers never appear in answers.

✅Quick check

What is data minimisation?

Show the answer

Using and keeping only the personal data that the purpose needs.

Name two places personal data can hide in an ML system.

Show the answer

For example prediction logs and documents indexed for RAG.

← PreviousExplaining models
ProLearners Assist