Skip to content
Merged
1 change: 1 addition & 0 deletions docs/api/paddle/static/Overview_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ io 相关 API

" :ref:`accuracy <cn_api_paddle_static_accuracy>` ", "计算精确率"
" :ref:`auc <cn_api_paddle_static_auc>` ", "计算 AUC"
" :ref:`ctr_metric_bundle <cn_api_paddle_static_ctr_metric_bundle>` ", "计算 CTR 相关指标"


.. _about_others:
Expand Down
39 changes: 39 additions & 0 deletions docs/api/paddle/static/ctr_metric_bundle_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.. _cn_api_paddle_static_ctr_metric_bundle:

ctr_metric_bundle
-------------------------------

.. py:function:: paddle.static.ctr_metric_bundle(input, label, ins_tag_weight=None)

CTR 相关度量层

此函数用于计算 CTR 相关指标:RMSE(均方根误差)、MAE(平均绝对误差)、predicted_ctr(预测点击率)、q 值。

为了计算这些指标的最终值,我们应该使用总实例数进行以下计算:
MAE = local_abserr / 实例数
RMSE = sqrt(local_sqrerr / 实例数)
predicted_ctr = local_prob / 实例数
q = local_q / 实例数
注意,如果您正在进行分布式作业,您应该首先对这些指标和实例数进行全局归约。

参数
::::::::::::
- **input** (Tensor) - 一个浮点数 2D 张量,值在[0, 1]范围内。每行按降序排列。这个输入应该是 topk 的输出。通常,这个张量表示每个标签的概率。
- **label** (Tensor) - 表示训练数据标签的 2D 整数张量。高度为批量大小,宽度始终为 1。
- **ins_tag_weight** (Tensor) - 表示训练数据的 ins_tag_weight 的 2D 整数张量。1 表示真实数据,0 表示假数据。类型为 float32 或 float64 的 LoDTensor 或 Tensor。

返回
::::::::::::
- **local_sqrerr** (Tensor) - 局部平方误差和
- **local_abserr** (Tensor) - 局部绝对误差和
- **local_prob** (Tensor) - 局部预测 CTR 和
- **local_q** (Tensor) - 局部 q 值和

返回类型
::::::::::::
local_sqrerr(Tensor)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里改成返回tuple元组数据类型吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里改成返回tuple元组数据类型吧

Done,这里参考paddle.sparse.nn.functional.conv3d的返回类型格式进行修改,即:仅写明数据类型。

还有一类返回类型格式为paddle.linalg.pca_lowrank一类,即:归类在返回一栏中标明元组中的参数。

麻烦开发者看一下是否需要改成第二种类型

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里改成返回tuple元组数据类型吧

Done,这里参考paddle.sparse.nn.functional.conv3d的返回类型格式进行修改,即:仅写明数据类型。

还有一类返回类型格式为paddle.linalg.pca_lowrank一类,即:归类在返回一栏中标明元组中的参数。

麻烦开发者看一下是否需要改成第二种类型

改成第二种类型吧,更加准确直观一点

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


代码示例:
::::::::::

COPY-FROM: paddle.static.ctr_metric_bundle