Skip to content

Instantly share code, notes, and snippets.

View unnir's full-sized avatar

Vadim Borisov unnir

View GitHub Profile
@SuperShinyEyes
SuperShinyEyes / f1_score.py
Created October 15, 2019 10:16
F1 score in PyTorch
def f1_loss(y_true:torch.Tensor, y_pred:torch.Tensor, is_training=False) -> torch.Tensor:
'''Calculate F1 score. Can work with gpu tensors
The original implmentation is written by Michal Haltuf on Kaggle.
Returns
-------
torch.Tensor
`ndim` == 1. 0 <= val <= 1
@ohjho
ohjho / remove_ipynb_checkpoints.sh
Last active October 16, 2023 18:49
How to remove .ipynb_checkpoints from Git Repo
# to remove the file on git without deleting from local
# use -> git rm --cached
find . -name .ipynb_checkpoints -print0 | xargs -0 git rm -r --ignore-unmatch
echo .ipynb_checkpoints >> .gitignore
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active September 11, 2024 11:40
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',