Lab 6
Lab 6
Actual
Predicted Happy Sad
Happy 85 15
Sad 20 80
b) Explain why each metric would or would not be appropriate for this application
c) If this system were to be used in mental health screening, which metric should be prioritized and why?
2. (10 points) The sigmoid function σ(z) = 1/(1 + e⁻ᶻ) is fundamental to logistic regression.
c) Explain why property (b) makes this function suitable for binary classification
4. (10 points) For a KNN classifier with k=3, consider the following five training points:
What class would be assigned to a test point at (3,3)? Show all distance calculations and explain your reasoning.
Actual
Predicted Happy Sad
Happy 85 15
Sad 20 80
1. Accuracy:
2. Precision:
3. Recall:
4. F1-score:
b) Metric Appropriateness:
= 1
Cat: 2.0
Dog: 1.0
Bird: -1.0
5. (10 points) For logistic regression with two features x₁ and x₂, weights w₁=2, w₂=-1, and bias b=1:
1. Calculate exponentials:
5. Calculate probabilities:
3. Simplify:
1 + e^-(2x₁ - x₂ + 1) = 2
e^-(2x₁ - x₂ + 1) = 1
-(2x₁ - x₂ + 1) = 0
2x₁ - x₂ + 1 = 0
a) The mathematical basis for why KNN can handle non-linear decision boundaries while logistic regression cannot
8. (15 points) Consider a face recognition system that needs to classify expressions into: Happy, Sad, Angry, Surprised.
b) Calculate the number of binary classifiers needed for both One-vs-All and One-vs-One approaches
c) Explain mathematically why softmax regression might be more appropriate than multiple logistic regressions
Prediction phase:
Prediction phase:
Complete formulation:
One-vs-All:
One-vs-One:
Number = K(K-1)/2
Here: 4(4-1)/2 = 6 classifiers
Pairs: (Happy-Sad), (Happy-Angry), (Happy-Surprised), (Sad-Angry), (Sad-Surprised), (Angry-Surprised)
Mathematical explanation:
Loading [MathJax]/jax/output/CommonHTML/fonts/TeX/fontdata.js