Skip to main content

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可以是由方向指示类别的随机向量/嵌入、概率、独热编码. 概率或独热编码输入时最好各类别独立进行标准化后再送入损失函数.

Metadata

Release files for orientLoss 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for orientLoss 0.0.8
File Size Uploaded
orientloss-0.0.8.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for orientLoss 0.0.8
File Interpreter ABI Platform
orientloss-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / orientloss-0.0.8.tar.gz

Download URL orientloss-0.0.8.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8b2760ce01a70dac8266ffa185b59387ca33d405d3edf018bdc549943aeadf0e
BLAKE2b-256 checksum
How to use checksums
01e67758be0d85352b8ccd9f9808ace74d8a308ca488283325f42c539c5bb0c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 17, 2025.

Transparency log

Release files / orientloss-0.0.8-py3-none-any.whl

Download URL orientloss-0.0.8-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99c2acc7a33d4aebf81ec4008403582d9db05c4d43755064d80ce29d8a14c28a
BLAKE2b-256 checksum
How to use checksums
56272a8a0ca2627ebdfc46dd8e5f3f0a99bd25b3d8dbe1106afd380d39af9d7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 17, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page