Standardization
जहाँ normalization दो डेटा पॉइंट्स के बीच किसी कॉलम को स्केल करने में मददगार हो सकता है, वहीं अगर किसी एक कॉलम पर outliers का बहुत प्रभाव हो, तो दो स्केल किए गए कॉलम्स की तुलना करना कठिन हो जाता है। इसका एक प्रचलित समाधान standardization है, जिसमें सख्त upper और lower bound रखने के बजाय, आप डेटा को उसके mean के आसपास केंद्रित करते हैं और हर डेटा पॉइंट के mean से कितने standard deviations दूर होने की गणना करते हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में मशीन लर्निंग के लिए फीचर इंजीनियरिंग
अभ्यास निर्देश
sklearnकेpreprocessingमॉड्यूल सेStandardScalerइम्पोर्ट करें.StandardScaler()कोSS_scalerके रूप में instantiate करें.so_numeric_dfकेAgeकॉलम परStandardScalerको fit करें.- अभी fit किए गए scaler से उसी कॉलम को transform करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Import StandardScaler
____
# Instantiate StandardScaler
SS_scaler = ____()
# Fit SS_scaler to the data
____.____(so_numeric_df[['Age']])
# Transform the data using the fitted scaler
so_numeric_df['Age_SS'] = ____.____(so_numeric_df[['Age']])
# Compare the origional and transformed column
print(so_numeric_df[['Age_SS', 'Age']].head())