Let’s say we have a logistic regression model that takes
num_features and outputs
num_classes is equal to one.
Now if I want to weight my loss function, I would make something like this:
F.binary_cross_entropy(probas, target, weight=torch.tensor())
Where my weights were calculated by:
# n samples / n_classes * bincount ((183473+47987) / (2 * np.array([183473, 47987]))) [0.63074419 2.41213088] # [0, 1]
My question is, the weight in the loss function, as I can only give it one value, which class is it for, 0 or 1?
target, in our data set, contains either zeros or ones, like a traditional binary regression problem.