शुरू करेंमुफ़्त में शुरू करें

KFold क्रॉस-वैलिडेशन

ML मॉडल्स के साथ काम करते समय, यह ज़रूरी होता है कि आप उनके प्रदर्शन को अनदेखे डेटा पर आँकें और यह सुनिश्चित करें कि मूल्यांकन सही हो. इस उद्देश्य के लिए एक आम तकनीक k-fold क्रॉस-वैलिडेशन है. इस अभ्यास में, आप देखेंगे कि k-fold क्रॉस-वैलिडेशन तकनीक किसी डेटासेट को training और testing सेट में कैसे बाँटती है. KFold आपके लिए इम्पोर्ट किया गया है, साथ ही heart disease डेटासेट के फीचर्स heart_disease_df_X भी उपलब्ध हैं.

यह अभ्यास पाठ्यक्रम का हिस्सा है

एंड-टू-एंड मशीन लर्निंग

पाठ्यक्रम देखें

अभ्यास निर्देश

  • n_splits=5, shuffle=True, और random_state=42 के साथ एक KFold ऑब्जेक्ट बनाएँ
  • kfold.split() का उपयोग करके डेटा स्प्लिट करें
  • ट्रेन और टेस्ट स्प्लिट्स में डाटापॉइंट्स की संख्या प्रिंट करें

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Create a KFold object
kfold = ____(____, ____, ____)

# Get the train and test data from the first split from the shuffled KFold
train_data_split, test_data_split = next(____.____(____))

# Print out the number of datapoints in the train and test splits
print("Number of training datapoints in heart_disease_df_X:", ____)
print("Number of training datapoints in split:", ____)
print("Number of testing datapoints in split:", ____)
कोड संपादित करें और चलाएँ