orientLoss


NameorientLoss JSON
Version 0.0.8 PyPI version JSON
download
home_pageNone
SummaryorientLoss 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.
upload_time2025-08-17 18:01:56
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords orientloss loss pytorch ai neural nn classification categories
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
```bash
pip install orientLoss
```

## Use
```python
from orientLoss import orientLoss
...
loss=orientLoss(input,target,dim=-1,meanOut=True,angleSmooth=1,normSmooth=1,dimScalingOrd=0,eps=1e-8)
```

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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "orientLoss",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "orientLoss, Loss, PyTorch, AI, neural, NN, classification, categories",
    "author": null,
    "author_email": "Psyche Halo <Psyche@WinsGod.com>",
    "download_url": "https://files.pythonhosted.org/packages/01/e6/7758be0d85352b8ccd9f9808ace74d8a308ca488283325f42c539c5bb0c2/orientloss-0.0.8.tar.gz",
    "platform": null,
    "description": "# orientLoss\norientLoss is a classification loss function. It less prone to overfitting compared to crossEntropy. Compatible with random vector/embeddings with direction-indicating categories\u3001probabilistic\u3001oneHot as target.\n\n## \u601d\u8def\u8bf4\u660e\n\u5f88\u591a\u65f6\u5019\u7f51\u7edc\u9700\u8981\u8f93\u51fa\u7684\u7c7b\u522b\u6570\u8fdc\u9ad8\u4e8e\u7f51\u7edc\u4e2d\u4f7f\u7528\u7684\u7279\u5f81\u6570/\u901a\u9053\u6570,\u9700\u8981\u5728\u6700\u540e\u4e00\u5c42\u52a0\u4e00\u4e2a\u5de8\u5927\u7684\u7ebf\u6027\u5c42\u5c06\u8f93\u51fa\u6269\u589e\u624d\u9001\u5165\u4ea4\u53c9\u71b5\u635f\u5931.\u4f46\u672c\u8d28\u4e0a\u8fd9\u4e00\u5c42\u5e76\u6ca1\u6709\u589e\u52a0\u4fe1\u606f\u91cf,\u6240\u4ee5\u53ef\u4ee5\u4f7f\u7528\u67d0\u4e9b\u635f\u5931\u51fd\u6570\u53d6\u4ee3\u8fd9\u4e00\u8fc7\u7a0b.\u518d\u8003\u8651\u5230\u4ea4\u53c9\u71b5\u7531\u4e8e\u5176\u4e0b\u964d\u6ca1\u6709\u7ec8\u70b9,\u5bb9\u6613\u5f15\u8d77\u8fc7\u62df\u5408.\u901a\u8fc7\u8bbe\u8ba1\u516c\u5f0f\u4ece\u5f62\u72b6\u4e0a\u903c\u8fd1\u548c\u4f18\u5316\u7ef4\u5ea6\u65e0\u9650\u6269\u589e\u540e\u7684\u4ea4\u53c9\u71b5\u635f\u5931\u5f97\u5230\u4e86\u8fd9\u4e2a\u635f\u5931\u51fd\u6570.\n\n## Install\n```bash\npip install orientLoss\n```\n\n## Use\n```python\nfrom orientLoss import orientLoss\n...\nloss=orientLoss(input,target,dim=-1,meanOut=True,angleSmooth=1,normSmooth=1,dimScalingOrd=0,eps=1e-8)\n```\n\ntarget\u53ef\u4ee5\u662f\u7531\u65b9\u5411\u6307\u793a\u7c7b\u522b\u7684\u968f\u673a\u5411\u91cf/\u5d4c\u5165\u3001\u6982\u7387\u3001\u72ec\u70ed\u7f16\u7801. \u6982\u7387\u6216\u72ec\u70ed\u7f16\u7801\u8f93\u5165\u65f6\u6700\u597d\u5404\u7c7b\u522b\u72ec\u7acb\u8fdb\u884c\u6807\u51c6\u5316\u540e\u518d\u9001\u5165\u635f\u5931\u51fd\u6570.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "orientLoss is a classification loss function @pytorch. It less prone to overfitting compared to crossEntropy. Compatible with random vector/embeddings with direction-indicating categories\u3001probabilistic\u3001oneHot as target. ",
    "version": "0.0.8",
    "project_urls": {
        "Homepage": "https://github.com/PsycheHalo/orientLoss",
        "Issues": "https://github.com/PsycheHalo/orientLoss/issues"
    },
    "split_keywords": [
        "orientloss",
        " loss",
        " pytorch",
        " ai",
        " neural",
        " nn",
        " classification",
        " categories"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "56272a8a0ca2627ebdfc46dd8e5f3f0a99bd25b3d8dbe1106afd380d39af9d7d",
                "md5": "07451a5ef9528a1c61c04ae24211598b",
                "sha256": "99c2acc7a33d4aebf81ec4008403582d9db05c4d43755064d80ce29d8a14c28a"
            },
            "downloads": -1,
            "filename": "orientloss-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "07451a5ef9528a1c61c04ae24211598b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8442,
            "upload_time": "2025-08-17T18:01:55",
            "upload_time_iso_8601": "2025-08-17T18:01:55.411951Z",
            "url": "https://files.pythonhosted.org/packages/56/27/2a8a0ca2627ebdfc46dd8e5f3f0a99bd25b3d8dbe1106afd380d39af9d7d/orientloss-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "01e67758be0d85352b8ccd9f9808ace74d8a308ca488283325f42c539c5bb0c2",
                "md5": "a74673860326b60c18c14bbee0db3a9a",
                "sha256": "8b2760ce01a70dac8266ffa185b59387ca33d405d3edf018bdc549943aeadf0e"
            },
            "downloads": -1,
            "filename": "orientloss-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "a74673860326b60c18c14bbee0db3a9a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8158,
            "upload_time": "2025-08-17T18:01:56",
            "upload_time_iso_8601": "2025-08-17T18:01:56.728451Z",
            "url": "https://files.pythonhosted.org/packages/01/e6/7758be0d85352b8ccd9f9808ace74d8a308ca488283325f42c539c5bb0c2/orientloss-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-17 18:01:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PsycheHalo",
    "github_project": "orientLoss",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "orientloss"
}
        
Elapsed time: 1.80012s