Python 中的数据隐私与匿名化
Rebeca Gonzalez
Instructor
$$
$$








差分隐私是隐私的数学定义。






希腊字母 ε:衡量发布数据的隐私与噪声。
例如 ε = 1。
e^1=2.72

# Get counts and bars for non-private histogram of salaries counts, bins = np.histogram(salaries)# Normalize counts to get proportions of the height proportions = counts / counts.sum()# Draw the histogram of proportions plt.bar(bins[:-1], height=proportions, width=(bins[1] - bins[0])) plt.show()

import diffprivlib.tools# Get counts and bars for private histogram of salaries with epsilon of 0.1 dp_counts, dp_bins = tools.histogram(salaries, epsilon=0.1)# Normalize counts to get proportions dp_proportions = dp_counts / dp_counts.sum()# Draw the histogram of proportions and see differences plt.bar(dp_bins[:-1], dp_proportions, width=(dp_bins[1] - dp_bins[0])) plt.show()
非私有直方图

私有直方图结果

Python 中的数据隐私与匿名化