Exercise

Histograms with differential privacy

In this exercise, you'll access the Heart Failure Prediction dataset following the differentially private approach. You will generate and analyze private and non-private histograms and compare them.

You'll focus on histograms from the age variable of the dataset. Although you can access the intact DataFrame in the console, in real life, you wouldn't share it without adding random noise calculated by differential privacy, following the global approach.

The DataFrame is loaded as heart_df while the Series holding the values from age is stored as ages. tools from diffprivlib is already imported.

Instructions 1/3

undefined XP
  • 1
    • Generate a numpy histogram from ages.
    • Normalize the counts to get proportions.
    • Draw the histogram using the proportions.
  • 2
    • Generate a differentially private histogram of ages, from tools.
    • Get the proportions.
    • Draw the histogram.
  • 3
    • Generate a differentially private histogram from ages with an epsilon of 0.4.
    • Get the proportions.
    • Draw the histogram.