Install to use
pip install pytorchLosses
Examples
from pytorchLosses import LabelSmoothingCrossEntropy,GamblersLoss,SCELoss,TruncatedLoss,FocalCosineLoss
a = torch.rand(4, 5)
b = torch.randint(0, 2, (4,))
loss_fun = LabelSmoothingCrossEntropy()
print(loss_fun(a,b))
print(GamblersLoss(a,b))
loss_fun = SCELoss(alpha=1.0,beta=1.0,num_classes=5).cuda()
print(loss_fun(a.cuda(),b.cuda()))
# Yet to test
loss_fun = TruncatedLoss(q=0.7, k=0.5, trainset_size=10000).cuda()
print(loss_fun(a.cuda(),b.cuda(),indexes=1))
loss_fun = FocalCosineLoss(alpha=1.0, gamma=2.0,xent=0.1).cuda()
print(loss_fun(a.cuda(),b.cuda()))
Explanation
Label_encoding
Neural net face 2 major error that are we usually told in every course and 1 major issue that is not famous which is called over confidence.
-
Over confidence
consider 100 examples within our dataset, each with predicted probability 0.9 by our model. If our model is calibrated, then 90 examples should be classified correctly. Similarly, among another 100 examples with predicted probabilities 0.6, we would expect only 60 examples being correctly classified. Copied form here. Read full artical and if you like him love by applauding his work. So basically convert [(0,1)] prediction to [(0.0333,0.9666)]
Download to develop
pip install -e .[dev]
Metadata
Release files for pytorchLosses 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytorchLosses-0.3.1.tar.gz | 15.8 kB | Without provenance | Details for pytorchLosses-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytorchLosses-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for pytorchLosses-0.3.1-py3-none-any.whl |
Total release size: 30.8 kB
Release files / pytorchLosses-0.3.1.tar.gz
| Download URL | pytorchLosses-0.3.1.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ee7f539a56201ea43d3e7ec75c27affa58e32d89d9115ddcbcffcb000f9203d
|
|
BLAKE2b-256 checksum How to use checksums |
ed4c77a5132315530c0c69b3b9eacd8889038c9a4ec2794cadf69d4d538ce9f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
|
Release files / pytorchLosses-0.3.1-py3-none-any.whl
| Download URL | pytorchLosses-0.3.1-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
63889dba62f9ba1b9bf7bdd583ef4971f73fba207ccff09f70746fd83e44f679
|
|
BLAKE2b-256 checksum How to use checksums |
da1d98876cf56d265ec0348c2b05afc12f007bd05473ef05357eea5516b515df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
|
Security for pytorchLosses 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.