orientLoss is a classification loss function @pytorch. It less prone to overfitting compared to crossEntropy. Compatible with random vector/embeddings with direction-indicating categories、probabilistic、oneHot as target.
Project description
orientLoss
orientLoss is a classification loss function. It less prone to overfitting compared to crossEntropy. Compatible with random vector/embeddings with direction-indicating categories、probabilistic、oneHot as target.
思路说明
很多时候网络需要输出的类别数远高于网络中使用的特征数/通道数,需要在最后一层加一个巨大的线性层将输出扩增才送入交叉熵损失.但本质上这一层并没有增加信息量,所以可以使用某些损失函数取代这一过程.再考虑到交叉熵由于其下降没有终点,容易引起过拟合.通过设计公式从形状上逼近和优化维度无限扩增后的交叉熵损失得到了这个损失函数.
Install
pip install orientLoss
Use
from orientLoss import orientLoss
...
loss=orientLoss(input,target,dim=-1,meanOut=True,angleSmooth=1,normSmooth=1,dimScalingOrd=0,eps=1e-8)
target可以是由方向指示类别的随机向量/嵌入、概率、独热编码. 概率或独热编码输入时最好各类别独立进行标准化后再送入损失函数.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file orientloss-0.0.7.tar.gz.
File metadata
- Download URL: orientloss-0.0.7.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c08824dfb4d9669782f9fc9482563d9a446d08c3b7b7b9d66eeb8cd22ac11ea4
|
|
| MD5 |
b33749b8b6b234ef58e36eb66e1c43b4
|
|
| BLAKE2b-256 |
4844706c4ba6ec0276a93c9fcdea3aa9296124c074329b0cbc95107660617cc1
|
Provenance
The following attestation bundles were made for orientloss-0.0.7.tar.gz:
Publisher:
python-publish.yml on PsycheHalo/orientLoss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orientloss-0.0.7.tar.gz -
Subject digest:
c08824dfb4d9669782f9fc9482563d9a446d08c3b7b7b9d66eeb8cd22ac11ea4 - Sigstore transparency entry: 362057003
- Sigstore integration time:
-
Permalink:
PsycheHalo/orientLoss@daf1002e3115424d7af154c5a400395aa58e955d -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/PsycheHalo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@daf1002e3115424d7af154c5a400395aa58e955d -
Trigger Event:
release
-
Statement type:
File details
Details for the file orientloss-0.0.7-py3-none-any.whl.
File metadata
- Download URL: orientloss-0.0.7-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d84aad65d270e65dbc6ece9e758ebeeb40af69de78fafa05b685432f24fa3ea2
|
|
| MD5 |
b696a941763f2ade49578e5505798810
|
|
| BLAKE2b-256 |
08013238a4d199cbb8025b2542d30b633925046eba62462c9c9c47d65131f8e7
|
Provenance
The following attestation bundles were made for orientloss-0.0.7-py3-none-any.whl:
Publisher:
python-publish.yml on PsycheHalo/orientLoss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orientloss-0.0.7-py3-none-any.whl -
Subject digest:
d84aad65d270e65dbc6ece9e758ebeeb40af69de78fafa05b685432f24fa3ea2 - Sigstore transparency entry: 362057016
- Sigstore integration time:
-
Permalink:
PsycheHalo/orientLoss@daf1002e3115424d7af154c5a400395aa58e955d -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/PsycheHalo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@daf1002e3115424d7af154c5a400395aa58e955d -
Trigger Event:
release
-
Statement type: