মেশিন লার্নিং মডেল ভালো কাজ করছে কি না—তা কিভাবে জানবেন? Accuracy ছাড়া আরও গুরুত্বপূর্ণ একটি টুল হলো Confusion Matrix। আজকের ব্লগে আমরা এটি সহজভাবে বুঝব।
🔍 Confusion Matrix কী?
Confusion Matrix একটি টেবিল আকারে হয়, যা মডেলের প্রেডিকশন আর প্রকৃত ফলাফল তুলনা করে দেখায়।
📐 Matrix Structure:
| Actual Positive | Actual Negative | |
|---|---|---|
| Predicted Positive | True Positive (TP) | False Positive (FP) |
| Predicted Negative | False Negative (FN) | True Negative (TN) |
🎯 মানে কী?
- TP: মডেল সঠিকভাবে পজিটিভ ধরেছে
- FP: মডেল ভুল করে পজিটিভ বলেছে
- FN: মডেল ভুলভাবে নেগেটিভ বলেছে
- TN: মডেল সঠিকভাবে নেগেটিভ বলেছে
📊 অন্যান্য গুরুত্বপূর্ণ মেট্রিকস:
- Accuracy: (TP + TN) / সবগুলো
- Precision: TP / (TP + FP)
- Recall: TP / (TP + FN)
- F1-Score: 2 × (Precision × Recall) / (Precision + Recall)
🧪 কোড উদাহরণ (Python):
from sklearn.metrics import confusion_matrix, classification_report
y_true = [1, 0, 1, 1, 0, 1, 0]
y_pred = [1, 0, 1, 0, 0, 1, 1]
cm = confusion_matrix(y_true, y_pred)
print("Confusion Matrix:")
print(cm)
print("\nClassification Report:")
print(classification_report(y_true, y_pred))
🤔 কবে Confusion Matrix দরকার?
- Binary Classification Problems যেমন Spam detection, Fraud detection
- Medical diagnosis যেখানে False Negative খুব গুরুত্বপূর্ণ
✍️ লেখক পরিচিতি
Amanul Islam বর্তমানে University of Colorado at Colorado Springs-এ PhD in Security করছেন। তিনি AI এবং সাইবার নিরাপত্তা নিয়ে গবেষণা করছেন। তার উদ্যোগে এই ব্লগ সিরিজটি তৈরি হয়েছে যেন বাংলা ভাষায় মেশিন লার্নিং শেখা সহজ হয়।
📘 আরও শিখতে পড়ুন আমাদের পরবর্তী ব্লগ: ROC Curve এবং AUC ব্যাখ্যা!
📢 ব্লগ লিংক: ICT Academy Bangladesh

0 মন্তব্যসমূহ