This question evaluates practical implementation skills for core machine learning components—computing AUC-ROC (including ROC point generation and handling ties or uniform labels), implementing a numerically stable softmax, and training logistic regression with cross-entropy loss and optional L2 regularization.
You are asked to implement a few core ML building blocks from scratch (no ML libraries such as scikit-learn). You may use basic numeric operations and standard data structures.
Given:
y_true
: length
n
list/array of binary labels in
{0,1}
y_score
: length
n
list/array of real-valued prediction scores (higher means more likely positive)
Task:
Clarifications:
y_score
correctly.
Given a vector of logits z = [z1, z2, ..., zk], implement softmax:
Task:
k
.
Given:
X
of shape
(n, d)
y
of shape
(n,)
in
{0,1}
Task:
predict_proba
/
predict
function.
Constraints/expectations: