orientLoss


NameorientLoss JSON
Version 0.0.2 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-07-30 17:18:02
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/78/0f/2439da05fb4fbf85f843d729262240cdb3e12a6dda03bbc2be7034bcd99c/orientloss-0.0.2.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.2",
    "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": "70ef9fea9fefc0c43f1cf503bb8624362b94fc20ca6b4405e40b416cd587ca1d",
                "md5": "8bfb90f5bfad32d13946001ac2af0223",
                "sha256": "9f88a5f48550a0772651a4a50818fa558b364f3aa7a7df122904b91f0df96e28"
            },
            "downloads": -1,
            "filename": "orientloss-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8bfb90f5bfad32d13946001ac2af0223",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8292,
            "upload_time": "2025-07-30T17:18:00",
            "upload_time_iso_8601": "2025-07-30T17:18:00.914879Z",
            "url": "https://files.pythonhosted.org/packages/70/ef/9fea9fefc0c43f1cf503bb8624362b94fc20ca6b4405e40b416cd587ca1d/orientloss-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "780f2439da05fb4fbf85f843d729262240cdb3e12a6dda03bbc2be7034bcd99c",
                "md5": "61f97eab9d38731635ea4b2c66581f67",
                "sha256": "9f8cd9037e4b22ac176b7d75dd6ee3f8fd37665d89cb8bdf232f1701001de733"
            },
            "downloads": -1,
            "filename": "orientloss-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "61f97eab9d38731635ea4b2c66581f67",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7966,
            "upload_time": "2025-07-30T17:18:02",
            "upload_time_iso_8601": "2025-07-30T17:18:02.248097Z",
            "url": "https://files.pythonhosted.org/packages/78/0f/2439da05fb4fbf85f843d729262240cdb3e12a6dda03bbc2be7034bcd99c/orientloss-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-30 17:18:02",
    "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: 0.77219s