Differential privacy के साथ Histograms
इस अभ्यास में, आप Heart Failure Prediction डेटासेट को differentially private तरीके से एक्सेस करेंगे। आप private और non-private दोनों तरह के histograms बनाएँगे, उनका विश्लेषण करेंगे, और उनकी तुलना करेंगे.
आपका फोकस डेटासेट के age वैरिएबल के histograms पर होगा। हालाँकि आप कंसोल में intact DataFrame देख सकते हैं, वास्तविक जीवन में आप इसे global approach का पालन करते हुए differential privacy से निकले random noise जोड़े बिना साझा नहीं करेंगे.
DataFrame heart_df नाम से लोड है, जबकि age से आने वाले मानों वाली Series ages के रूप में स्टोर है। diffprivlib के tools पहले से इम्पोर्ट किए गए हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में डेटा प्राइवेसी और अज्ञातिकरण
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Get counts and bars for non-private histogram of ages
counts, bins = ____
# Normalize counts to get proportions
proportions = ____
# Draw the histogram of proportions
plt.bar(____[: - 1], height=____, width=(bins[1] - bins[0]))
plt.show()