Model Pipeline - Privacy considerations
This pipeline shows how privacy is protected when training a machine learning model. It includes steps to keep personal data safe while still learning useful patterns.
This pipeline shows how privacy is protected when training a machine learning model. It includes steps to keep personal data safe while still learning useful patterns.
Loss
1.2 |*****
0.9 |****
0.7 |***
0.6 |**
0.55|*
+---------
Epochs 1-5| Epoch | Loss ↓ | Accuracy ↑ | Observation |
|---|---|---|---|
| 1 | 1.2 | 0.50 | Initial training with high loss and low accuracy |
| 2 | 0.9 | 0.65 | Loss decreases, accuracy improves as model learns |
| 3 | 0.7 | 0.75 | Model continues to improve with privacy noise added |
| 4 | 0.6 | 0.80 | Good balance between accuracy and privacy protection |
| 5 | 0.55 | 0.83 | Training converges with stable loss and accuracy |
def anonymize(data):
return [{k: (v if k != 'name' else 'REDACTED') for k, v in record.items()} for record in data]
sample_data = [{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}]
print(anonymize(sample_data))
What is the output?def remove_emails(data):
for record in data:
if 'email' in record:
record.pop('email')
return data
sample = [{'name': 'John', 'email': 'john@example.com'}, {'name': 'Jane'}]
print(remove_emails(sample))
What is the bug and how to fix it?Pass the test and this pattern moves unknown