DeepCTR
DeepCTR copied to clipboard
How to self define metric instead of using one of the pre-defined metrics
How to self define metric instead of using one of the pre-defined metrics
or how to add a sklearn metric into
def _get_metrics(self, metrics, set_eps=False):
metrics_ = {}
if metrics:
for metric in metrics:
if metric == "binary_crossentropy" or metric == "logloss":
if set_eps:
metrics_[metric] = self._log_loss
else:
metrics_[metric] = log_loss
if metric == "auc":
metrics_[metric] = roc_auc_score
if metric == "mse":
metrics_[metric] = mean_squared_error
if metric == "accuracy" or metric == "acc":
metrics_[metric] = self._accuracy_score
self.metrics_names.append(metric)
return metrics_