DataLane

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

Track progress 0/7

0% complete

Start with problem 1
  1. Step 1 · ~8 min · Google, OpenAI

    Mean squared error

    Implement mse(y_true, y_pred): the mean of squared residuals, rounded to 4 decimal places.

    PythonNumPyPyTorch
    mediumProNot started
  2. Step 2 · ~6 min · Amazon, Google

    Mean absolute error

    Implement mae(y_true, y_pred): the mean of absolute residuals, rounded to 4 decimal places.

    PythonNumPyPyTorch
    mediumProNot started
  3. Step 3 · ~12 min · Databricks, Google

    R-squared

    Return 1 - SS_res / SS_tot for y_true vs y_pred, rounded to 4 decimals. SS_tot uses the mean of y_true.

    PythonNumPyPyTorch
    hardProNot started
  4. Step 4 · ~12 min · Meta, Google

    Precision

    Binary 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.

    PythonNumPyPyTorch
    hardProNot started
  5. Step 5 · ~12 min · Meta, Google

    Recall

    Binary 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.

    PythonNumPyPyTorch
    hardProNot started
  6. Step 6 · ~14 min · OpenAI, Anthropic

    F1 score

    Binary 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.

    PythonNumPyPyTorch
    hardProNot started
  7. Step 7 · ~14 min · OpenAI, Anthropic

    Binary cross-entropy

    Mean binary cross-entropy of labels y in {0,1} and probabilities p in (0,1), rounded to 4 decimals. Use natural log.

    PythonNumPyPyTorch
    hardProNot started

Other tracks

↑↓ navigate openesc close