Privacy and minimization
Quick answer
Privacy-aware ML limits data collection, access, retention and release to what a documented purpose requires. Differential privacy (DP) is a formal guarantee about a randomized mechanism, not a synonym for anonymization or encryption. Examples are static Python snippets tested locally on CPU; The confusion matrix example requires scikit-learn; exercises use standard-library Python. ByteMind execution is unverified.
Mathematical noise scale only
from fractions import Fractionprint(Fraction(1)/Fraction(1,2))Expected output (locally tested): 2. This calculation is not a DP implementation.
How it works
For neighboring datasets D,D′ differing by a specified privacy unit, a mechanism M is (epsilon,delta)-DP when Pr[M(D) in S] <= exp(epsilon)*Pr[M(D′) in S]+delta for every measurable output event S and both neighbor directions. Define the unit (one row or one individual) before claiming a bound. Smaller epsilon means a tighter bound with other assumptions fixed. For a count query under add/remove-one-row adjacency its global sensitivity is 1; the mathematical Laplace mechanism uses scale sensitivity/epsilon for positive epsilon and delta=0. This lesson calculates scale only; it implements no release mechanism and makes no DP guarantee. Multiple releases consume budget; simple sequential composition adds epsilons and deltas. Real DP training requires verified clipping, noise, accounting, sampling and implementation assumptions. A fixed random seed for a private release is not a secure noise source. Removing a name may leave indirect identifiers; encryption protects stored or transmitted data but does not bound inference from outputs. Keep audit attributes only if justified, access-controlled and separated from serving inputs. Threat modeling lists assets, actors, boundaries and failure modes (unintended logging, unsafe artifacts, unauthorized access, poisoned data). Defenses include least privilege, retention limits, validation, provenance and monitoring. Test with synthetic fixtures only; never probe real people or systems.
Data minimization allowlist
row={"sensor":3,"mode":1,"debug_id":"synthetic-7"}print({k:row[k] for k in ("sensor","mode")})Expected output (locally tested): {'sensor': 3, 'mode': 1}. Only task-required features survive the allowlist.
Common mistakes
Do not call pseudonymized records anonymous, promise DP from adding arbitrary noise, or log raw sensitive examples to diagnose errors.
Practice and next steps
For a count with sensitivity 1 and epsilon 0.5, compute mathematical Laplace scale. Explain why a two-release budget at epsilon 0.5 each is at most 1 under basic sequential composition.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Privacy and minimization — knowledge check
Apply privacy and minimization to small examples and debugging scenarios.
What must a DP claim specify?
What is count sensitivity for add/remove one row?
What does basic sequential composition do?
Does deleting names guarantee anonymity?
Which is a defensive privacy practice?