ctr_metric_bundle

paddle.fluid.contrib.layers.metric_op. ctr_metric_bundle ( input, label ) [source]

ctr related metric layer

This function help compute the ctr related metrics: RMSE, MAE, predicted_ctr, q_value. To compute the final values of these metrics, we should do following computations using total instance number: MAE = local_abserr / instance number RMSE = sqrt(local_sqrerr / instance number) predicted_ctr = local_prob / instance number q = local_q / instance number Note that if you are doing distribute job, you should all reduce these metrics and instance number first

Parameters
  • input (Variable) – A floating-point 2D Variable, values are in the range [0, 1]. Each row is sorted in descending order. This input should be the output of topk. Typically, this Variable indicates the probability of each label.

  • label (Variable) – A 2D int Variable indicating the label of the training data. The height is batch size and width is always 1.

Returns

Local sum of squared error local_abserr(Variable): Local sum of abs error local_prob(Variable): Local sum of predicted ctr local_q(Variable): Local sum of q value

Return type

local_sqrerr(Variable)

Examples

import paddle.fluid as fluid
data = fluid.layers.data(name="data", shape=[32, 32], dtype="float32")
label = fluid.layers.data(name="label", shape=[1], dtype="int32")
predict = fluid.layers.sigmoid(fluid.layers.fc(input=data, size=1))
auc_out = fluid.contrib.layers.ctr_metric_bundle(input=predict, label=label)