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

फ्रॉड डिटेक्शन की वास्तविक लागत

आपने मूल प्रशिक्षण सेट (model_orig) और rebalanced प्रशिक्षण सेट (model_smote) पर दो मॉडल बनाए हैं। test सेट में दिए गए केसेज़ के लिए predicted classes क्रमशः predicted_class_orig और predicted_class_smote कहलाते हैं। फ्रॉड डिटेक्शन मॉडलों की तुलना केवल accuracy के आधार पर करने के बजाय, उनकी detection cost निकालना बेहतर होता है.

यहाँ cost_model() फंक्शन की परिभाषा दी गई है। इसे देखें ताकि आप समझ सकें कि लागत कैसे compute होती है.

cost_model <- function(predicted.classes, true.classes, amounts, fixedcost) {
  library(hmeasure)
  predicted.classes <- relabel(predicted.classes)
  true.classes <- relabel(true.classes)
  cost <- sum(true.classes * (1 - predicted.classes) * amounts + predicted.classes * fixedcost)
  return(cost)
}

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

R में Fraud Detection

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

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

  • cost_model() का उपयोग करके model_orig को test सेट पर deploy करने की वास्तविक लागत निकालें, जहाँ fixedcost 10 के बराबर है.
  • cost_model() का उपयोग करके model_smote को test सेट पर deploy करने की वास्तविक लागत निकालें, जहाँ fixedcost 10 के बराबर है.

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

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

# Calculate the total cost of deploying the original model
cost_model(___, ___, ___, ___)

# Calculate the total cost of deploying the model using SMOTE
cost_model(___, ___, ___, ___)
कोड संपादित करें और चलाएँ