Spring ¡®22 AI
Homework 10: solutions
1. [5 pts.] Suppose that a classifier computes a numeric score to an item based on the classifier¡¯s ¡°confidence¡± that the item is a member of the target category. In using the classifier, you set a threshold, accept the items whose score is higher than the threshold, and reject items whose score is lower. For instance, suppose you have the following training set and outputs for a binary classifier:
If you then set the threshold at 0.50, the classifier will accept items a-k and reject items l-t. However only the ‘T’ items should have been accepted.
Copyright By PowCoder代写 加微信 powcoder
Compute precision, recall, and F-score for the following thresholds: 0.9, 0.8,0.7, 0.4, 0.2.
2. [5 pts.] Using the following training set with k-nearest neighbors
Indicate the predicted label for each element of the following test set, also provide precision and recall.
Use Euclidean distance squared, unit votes, and K=3.
Solutions:
0.9) includes just {a,b} P=2/2 R=2/8 F=2/5
0.8) includes {a-e} P=3/5 R=3/8 F=6/13 0.7) includes {a-g} P=5/7 R=5/8 F=2/3
0.4) includes {a-n} P=6/14 R=6/8 F=12/22
0.2) includes {a-q} P=7/17 R=7/8 F=14/25
3,6,A -> NN=[<[2 2]> 9.000000 <[3 3]> 2.000000 <[4 5]>], vote=[A:2 B:1] label=A
20,5,B -> NN=[<[17 19]> 116.000000 <[10 9]> 85.000000 <[14 12]>], vote=[A:1 B:2] label=B 6,6,A -> NN=[<[10 9]> 18.000000 <[3 3]> 5.000000 <[4 5]>], vote=[A:2 B:1] label=A
19,9,A -> NN=[<[17 19]> 81.000000 <[10 9]> 34.000000 <[14 12]>], vote=[A:1 B:2] label=B 17,19,B -> NN=[<[8 13]> 58.000000 <[14 12]> 0.000000 <[17 19]>], vote=[B:3] label=B
Label=A Precision=2/2 Recall=2/3 Label=B Precision=2/3 Recall=2/2
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com