ML | Model evaluation | Basics | Priority Flashcards

1
Q

Write a confusion matrix with labels.

A

(See source material.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Equation for the error of a binary classification model. The numerator includes which cells in a confusion matrix?

A

err = (fp + fn) / (tp + fp + tn + fn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Equation for the accuracy of a binary classification model. The numerator includes which cells in a confusion matrix?

A

acc = (tp + tn)/ (tp + fp + tn + fn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Equation for the true positive rate of a binary classification model. The denominator includes which cells in a confusion matrix?

A

tpr = tp / (tp + fn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Equation for the false positive rate of a binary classification model. The denominator includes which cells in a confusion matrix?

A

fpr = fp / (fp + tn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Equation for precision. Optimizing precision comes at the cost of which cell in a confusion matrix?

A

precision = tp / (tp + fp); fn

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Equation for recall. Optimizing recall comes at the cost of which cell in a confusion matrix?

A

recall = tp / (tp + fn); fp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Equation for F1 in terms of precision and recall. What in a confusion matrix does F-score not take into account?

A

f1 = 2 * (p * r) / (p+r)
TN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain how a ROC curve works?

A

[Machine Learning with PyTorch and Scikit-Learn] Receiver operating characteristic (ROC) graphs are useful tools to select models for classification based on their performance with respect to the FPR and TPR, which are computed by shifting the decision threshold of the classifier. The diagonal of a ROC graph can be interpreted as random guessing, and classification models that fall below the diagonal are considered as worse than random guessing. A perfect classifier would fall into the top-left corner of the graph with a TPR of 1 and an FPR of 0. Based on the ROC curve, we can then compute the so-called ROC area under the curve (ROC AUC) to characterize the performance of a classification model.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does accuracy typically relate to ROC AUC? How is AUC typically thought to be better?

A

Typically similar. AUC is typically thought to better account for class imbalance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Equations for micro-average precision and macro-average precision.

A

p_micro = (tp_1 + … + tp_k) / (tp_1 + … + tp_k + fp_1 + … + fp_k)
P_macro = (p_1 + … + p_k) / k

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are some ways to deal with class imbaance?

A

assign a larger penalty to wrong predictions on the minority class (class_weight=’balanced’); upsampling the minority class (resample function), downsampling the majority class (using the resample function, we could simply swap the class 1 label with class 0), and the generation of synthetic training examples (Synthetic Minority Over-sampling Technique (SMOTE) via imbalanced-learn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Can you cite some examples where a false positive is more important than a false negative? (I.e want to minimize fp rather than minimize fn.)

Nouri 800
Machine Learning with PyTorch and Scikit-Learn Data analysis q8 p23; Chapter 6 p196

A

Optimizing for high precision will decrease fps at the cost of increasing fns (i.e missed detections). Chemotherapy example: want to decrease fp (actual tumor = 0, predict tumor=1). (See source material.)

Nouri 800
Machine Learning with PyTorch and Scikit-Learn Data analysis q8 p23; Chapter 6 p196

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Can you cite some examples where a false negative is more important than a false positive? (I.e want to minimize fns rather than minimize fps).

A

Optimizing high recall will decrease fns (i.e reduce missed detections) at the cost of increasing fps. Example: Don’t want to let criminal go free (actual crime=1, predict crime=0). Example: Don’t want to miss fraud (actual fraud=1, predict fraud = 0).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Can you cite some examples where both false positives and false negatives are equally important?

A

Example: idea detection. (See source material.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the various steps involved in an analytics project?

Nouri 800 ML q21 p43

A

(See source material.)

Nouri 800 ML q21 p43

17
Q

What’s the difference between Type I and Type II error?

A

fp vs. fn. (See source material.)

18
Q

How to do error analysis in a machine learning pipeline?

A

Automated scoring: 1. Agreement – meets a threshold? 2. Confusion matrix + bar charts – biggest off-diagonals, examples, any examples mis-labeled? 3. Fairness; 4. Ablation. (See source material.)