Back to problems

Implement Binary Focal Loss

Algorithm · Datadog · Medium

Problem: Implement Binary Focal Loss You are given a set of n binary classification samples. Each sample has a true label y_i that is either 0 or 1, and a predicted probability p_i for the positive class. Your task is to compute the Binary Focal Loss. For every sample, define two intermediate values based on the true label: When y_i = 1: p_t = p_i and alpha_t = alpha. When y_i = 0: p_t = 1 - p_i and alpha_t = 1 - alpha. The loss contributed by a single sample is calculated…

Checking your access…