208 Star 856 Fork 630

GVPMindSpore / mindscience

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mindsponge.metrics.BalancedMSE.rst 1.35 KB
一键复制 编辑 原始数据 按行查看 历史
luojianing 提交于 2023-04-14 17:28 . add ` for values in docs

mindsponge.metrics.BalancedMSE

.. py:class:: mindsponge.metrics.BalancedMSE(first_break, last_break, num_bins, beta=0.99, reducer_flag=False)

    计算预测值和真实值之间的均衡平方误差,适用于回归任务中标签不平衡的场景。详细实现过程参考: `Ren, Jiawei, et al. 'Balanced MSE for Imbalanced Visual Regression' <https://arxiv.org/abs/2203.16427>`_ 。

    .. math::
        L =-\log \mathcal{N}(\boldsymbol{y} ; \boldsymbol{y}_{\text {pred }}, \sigma_{\text {noise }}^{2} \mathrm{I})+\log \sum_{i=1}^{N} p_{\text {train }}(\boldsymbol{y}_{(i)}) \cdot \mathcal{N}(\boldsymbol{y}_{(i)} ; \boldsymbol{y}_{\text {pred }}, \sigma_{\text {noise }}^{2} \mathrm{I})

    参数:
        - **first_break** (float) - bin划分的起始位置。
        - **last_break** (float) - bin划分的结束位置。
        - **num_bins** (int) - 划分bin的数目。
        - **beta** (float) - 滑动平均的系数。默认值: ``0.99``。
        - **reducer_flag** (bool) - 是否对多卡的标签值做聚合。默认值: ``False``。

    输入:
        - **prediction** (Tensor) - 模型预测值,shape为 :math:`(batch\_size, ndim)` 。
        - **target** (Tensor) - 标签值,shape为 :math:`(batch\_size, ndim)` 。

    输出:
        Tensor。shape为 :math:`(batch\_size, ndim)` 。
1
https://gitee.com/mindspore/mindscience.git
git@gitee.com:mindspore/mindscience.git
mindspore
mindscience
mindscience
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891