Exercise

Define a competition metric

Competition metric is used by Kaggle to evaluate your submissions. Moreover, you also need to measure the performance of different models on a local validation set.

For now, your goal is to manually develop a couple of competition metrics in case if they are not available in sklearn.metrics.

In particular, you will define:

  • Mean Squared Error (MSE) for the regression problem: $$MSE = \frac{1}{N}\sum_{i=1}^{N}{(y_i - \hat{y}_i)^2}$$

  • Logarithmic Loss (LogLoss) for the binary classification problem: $$LogLoss = -\frac{1}{N}\sum_{i=1}^{N}{(y_i\ln p_i + (1-y_i)\ln (1-p_i))}$$

Instructions 1/2

undefined XP
  • 1
    • Using numpy, define MSE metric. As a function input, you're given true y_true and predicted y_pred arrays.
  • 2
    • Using numpy, define LogLoss metric. As input, you're given true class y_true and probability predicted prob_pred.