Posts
Showing posts with the label F1 score
Precision and Recall
- Get link
- X
- Other Apps
Precision and Recall Scikit-Learn provides several functions to compute classifier metrics , including precision and recall : from sklearn.metrics import precision_score , recall_score precision_score ( y_train_5 , y_train_pred ) # == 4096 / (4096 + 1522) 0.7290850836596654 recall_score ( y_train_5 , y_train_pred ) # == 4096 / (4096 + 1325) 0.7555801512636044 · Now your 5-detector does not look as shiny as it did when you looked at its accuracy . · When it claims an image represents a 5 , it is correct only 72.9% of the time. · Moreover, it only detects 75.6% of the 5 s. • It is often convenient to combine ü precision and ü recall into a single metric called the F1 score , ü in particular if you need a simple way to compare two classifiers . • The F1 score is the harmonic mean of precision and recall . F1Score • Whereas the regular mean treats all values equally , ü the ha
Confusion Matrix
- Get link
- X
- Other Apps
Confusion Matrix · A much better way to evaluate the performance of a classifier is to look at the confusion matrix . · The general idea is to · count the number of times instances of class A are classified as class B. · For example, ü to know the number of times the classifier confused images of 5s with 3s , ü you would look in · the fifth row and · third column of the confusion matrix . ü To compute the confusion matrix , • you first need to have a set of predictions so that they can be compared to the actual targets . • You could make predictions on the test set. • Remember that you want to use the test set only at the very end of your project , once you have a classifier that you are ready to launch . ü Instead, you can use the cross_val_predict() function: from sklearn.model_selection import cross_val_predict y_train_pred = cross_val_predict ( sgd_clf , X_t
Machine Learning - Classification MCQs
- Get link
- X
- Other Apps
Machine Learning - Classification - MCQs 1. By default, SGD classifier follows this strategy for multi-class classification: Top of Form A) OvO strategy B) OvA strategy C) Both D) None Ans: B 2. SGD Classifiers and Linear Classifiers are strictly A) Binary Classifier B) Multiclass classifier C) Both D) None Ans: A 3. The greater the value for ROC AUC, better the model: Top of Form A) True B) False Bottom of Form Ans: A 4. The maximum value of the ROC AUC is Top of Form A) 0.8 B) 0.9 C) 1 D) 0.7 Bottom of Form Ans: C 5. Recall can be increased by increasing the decision threshold. True or False Top of Form ? A) False B) True Ans: A 6. Precision can be increased by increasing the decision threshold. True or False? A) True B) False Ans: A 7. Which of these is a good measure to decide which threshold to use?