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

F-beta स्कोर

F-beta स्कोर precision और recall के बीच weighted हार्मोनिक मीन होता है, और इसका उपयोग precision और recall को अलग-अलग वेट देने के लिए किया जाता है. अक्सर आप precision को recall से ज़्यादा वेट देना चाहेंगे, जो 0 और 1 के बीच कम beta रखने से किया जा सकता है. इस अभ्यास में, आप एक MLP क्लासिफायर का precision और recall निकालेंगे, और beta = 0.5 के साथ F-beta स्कोर भी गणना करेंगे.

X_train, y_train, X_test, y_test आपके workspace में उपलब्ध हैं, और फीचर्स पहले से standardized हैं. pandas as pd और sklearn भी उपलब्ध हैं. sklearn.metrics से fbeta_score() भी उपलब्ध है.

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

Python में Machine Learning के साथ CTR प्रेडिक्शन

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

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

  • डेटा को training और testing सेट में विभाजित करें.
  • एक MLP क्लासिफायर परिभाषित करें, .fit() से ट्रेन करें, और .predict() से प्रेडिक्ट करें.
  • sklearn की implementations का उपयोग करके precision, recall स्कोर्स और F-beta स्कोर्स प्राप्त करें.

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

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

# Set up MLP classifier, train and predict
X_train, X_test, y_train, y_test = ____(
  ____, ____, test_size = .2, random_state = 0)
clf = ____(hidden_layer_sizes = (16, ), 
                    max_iter = 10, random_state = 0)
y_pred = clf.____(____, _____).____(X_test) 

# Evaluate precision and recall
prec = ____(y_test, ____, average = 'weighted')
recall = ____(y_test, ____, average = 'weighted')
fbeta = ____(y_test, ____, ____  = 0.5, average = 'weighted')
print("Precision: %s, Recall: %s, F-beta score: %s" %(prec, recall, fbeta))
कोड संपादित करें और चलाएँ