Skip to content

Commit

Permalink
Update autoPyTorch/utils/implementations.py
Browse files Browse the repository at this point in the history
Co-authored-by: nabenabe0928 <47781922+nabenabe0928@users.noreply.github.com>
  • Loading branch information
franchuterivera and nabenabe0928 committed Jun 23, 2021
1 parent f9a5704 commit 0d1e50a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions autoPyTorch/utils/implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __call__(self, y: Union[np.ndarray, torch.Tensor]) -> np.ndarray:
y = y.detach().cpu().numpy() if y.is_cuda else y.numpy()
counts_one = np.sum(y, axis=0)
counts_zero = y.shape[0] - counts_one
# pos_weight for torch.nn.BCEWithLogitsLoss
weights = counts_zero / np.maximum(counts_one, 1)

return np.array(weights)
Expand Down

0 comments on commit 0d1e50a

Please sign in to comment.