Python problem track
ML metrics
Losses and scores a scientist or ML engineer must implement without sklearn: MSE, R², precision, recall, F1, BCE.
7 problems · ~78 min total · Data Scientist · ML Engineer · MLOps Engineer · AI Engineer
Step 1 · ~8 min · Google, OpenAI
Mean squared errorImplement mse(y_true, y_pred): the mean of squared residuals, rounded to 4 decimal places.
PythonNumPyPyTorchmediumProNot startedStep 2 · ~6 min · Amazon, Google
Mean absolute errorImplement mae(y_true, y_pred): the mean of absolute residuals, rounded to 4 decimal places.
PythonNumPyPyTorchmediumProNot startedStep 3 · ~12 min · Databricks, Google
R-squaredReturn 1 - SS_res / SS_tot for y_true vs y_pred, rounded to 4 decimals. SS_tot uses the mean of y_true.
PythonNumPyPyTorchhardProNot startedStep 4 · ~12 min · Meta, Google
PrecisionBinary precision: TP / (TP + FP) for labels y and predictions pred in {0,1}. Round to 4 decimals. If there are no predicted positives, return 0.
PythonNumPyPyTorchhardProNot startedStep 5 · ~12 min · Meta, Google
RecallBinary recall: TP / (TP + FN) for labels y and predictions pred in {0,1}. Round to 4 decimals. If there are no actual positives, return 0.
PythonNumPyPyTorchhardProNot startedStep 6 · ~14 min · OpenAI, Anthropic
F1 scoreBinary F1: the harmonic mean of precision and recall for labels y and predictions pred in {0,1}. Round to 4 decimals. If precision + recall is 0, return 0.
PythonNumPyPyTorchhardProNot startedStep 7 · ~14 min · OpenAI, Anthropic
Binary cross-entropyMean binary cross-entropy of labels y in {0,1} and probabilities p in (0,1), rounded to 4 decimals. Use natural log.
PythonNumPyPyTorchhardProNot started