New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[esmm][protos]modify esmm,add auc.num_thresholds #76
Conversation
poson
commented
Nov 22, 2021
- DNN has 0 neuro means just return concated input features
- ESMM change loss functions ,avoid the loss of accuracy 。use sqrt to the probs of ctcvr 。
- add AUC.num_thresholds
- use metric.auc.num_thresholds to access num_thresholds
2. ESMM change loss functions ,avoid the loss of accuracy 。use sqrt to the probs of ctcvr 。 3. add AUC.num_thresholds
easy_rec/python/model/esmm.py
Outdated
weights=self._sample_weight) | ||
ctr_loss = tf.reduce_sum(tf.nn.sigmoid_cross_entropy_with_logits(labels=tf.cast(self._labels[ctr_label_name], tf.float32), | ||
logits=self._prediction_dict['logits_%s' % ctr_tower_name]), | ||
name="cvr_loss") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cvr_loss => ctr_loss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
easy_rec/python/model/esmm.py
Outdated
@@ -111,7 +109,7 @@ def build_metric_graph(self, eval_config): | |||
ctr_label_name = self._label_name_dict[ctr_tower_name] | |||
for metric in self._cvr_tower_cfg.metrics_set: | |||
# CTCVR metric | |||
ctcvr_label_name = cvr_label_name + '_ctcvr' | |||
ctcvr_label_name = cvr_label_name + '_ctcvrsqrt' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ctcvrsqrt => _ctcvr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
easy_rec/python/model/esmm.py
Outdated
self._labels[ctr_label_name], | ||
self._prediction_dict['logits_%s' % ctr_tower_name], | ||
weights=self._sample_weight) | ||
ctr_loss = tf.reduce_sum(tf.nn.sigmoid_cross_entropy_with_logits(labels=tf.cast(self._labels[ctr_label_name], tf.float32), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-commit run -a
@@ -159,6 +157,8 @@ def _add_to_prediction_dict(self, output): | |||
self._prediction_dict['probs_%s' % self._ctr_tower_cfg.tower_name]) | |||
# pctcvr = pctr * pcvr | |||
self._prediction_dict['probs_ctcvr'] = prob | |||
self._prediction_dict['probs_ctcvrsqrt'] = tf.sqrt(prob) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop it
easy_rec/python/model/esmm.py
Outdated
self._prediction_dict['probs_ctcvr'], | ||
weights=self._sample_weight) | ||
ctcvr_label = tf.cast(self._labels[cvr_label_name] * self._labels[ctr_label_name], tf.float32) | ||
cvr_losses = tf.keras.backend.binary_crossentropy(ctcvr_label, self._prediction_dict['probs_ctcvr']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test
LGTM |