डेंसिटी प्लॉट्स की तुलना
जो भी इम्प्यूटेशन आपने पहले किए हैं, उन्हें उनके डेंसिटी प्लॉट्स के ज़रिए ग्राफ़िकली तुलना किया जा सकता है. इन प्लॉट्स से आप आसानी से विश्लेषण कर पाएँगे और वह डेटासेट ढूँढ पाएँगे जिसकी डिस्ट्रीब्यूशन, ओरिजिनल डेटासेट से सबसे अधिक मिलती-जुलती है. आप यह भी देख पाएँगे कि इम्प्यूटेशन में बायस कैसे आ सकता है.
इस अभ्यास में, आप पहले बनाए गए diabetes के Imputed DataFrames के डेंसिटी प्लॉट्स की तुलना करेंगे.
DataFrames diabetes_cc, diabetes_mean_imputed, diabetes_knn_imputed और diabetes_mice_imputed आपके लिए पहले से लोड किए गए हैं, साथ ही matplotlib.pyplot को plt नाम से इम्पोर्ट किया गया है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Missing Data से निपटना
अभ्यास निर्देश
- हर DataFrame के लिए
'Skin_Fold'कॉलम का डेंसिटी प्लॉट बनाएँ. labelsलिस्ट का उपयोग करके लेबल्स सेट करें.- x-axis के लिए लेबल
'Skin Fold'सेट करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Plot graphs of imputed DataFrames and the complete case
diabetes_cc['___'].___(___='___', c='red', linewidth=3)
diabetes_mean_imputed['___'].plot(___='___')
diabetes_knn_imputed['___'].plot(___='___')
diabetes_mice_imputed['___'].plot(___='___')
# Create labels for the four DataFrames
labels = ['Baseline (Complete Case)', 'Mean Imputation', 'KNN Imputation', 'MICE Imputation']
plt.legend(___)
# Set the x-label as Skin Fold
plt.xlabel('___')
plt.show()