def to_bigdl_metric(metric, loss): metric = metric.lower() loss_str = (loss if isinstance(loss, six.string_types) else loss.__class__.__name__).lower() if metric == "accuracy" or metric == "acc": if loss_str == "sparse_categorical_crossentropy"\ or loss_str == "sparsecategoricalcrossentropy": return metrics.SparseCategoricalAccuracy() elif loss_str == "categorical_crossentropy"\ or loss_str == "categoricalcrossentropy": return metrics.CategoricalAccuracy() elif loss_str == "binary_crossentropy"\ or loss_str == "binarycrossentropy": return metrics.BinaryAccuracy() else: raise TypeError( "Not supported combination: metric {} and loss {}".format( metric, loss_str)) elif metric == "top5accuracy" or metric == "top5acc": return metrics.Top5Accuracy() elif metric == "mae": from bigdl.optim.optimizer import MAE return MAE() elif metric == "auc": return metrics.AUC() elif metric == "loss": return Loss() elif metric == "treennaccuracy": return TreeNNAccuracy() else: raise TypeError("Unsupported metric: %s" % metric)
def _to_bigdl_metric(metric): metric = metric.lower() if metric == "accuracy" or metric == "acc": return metrics.Accuracy() elif metric == "top5accuracy" or metric == "top5acc": return metrics.Top5Accuracy() elif metric == "mae": from bigdl.optim.optimizer import MAE return MAE() elif metric == "auc": return metrics.AUC() elif metric == "treennaccuracy": return TreeNNAccuracy() else: raise TypeError("Unsupported metric: %s" % metric)
def to_bigdl_metric(metric): metric = metric.lower() if metric == "accuracy" or metric == "acc": return metrics.Accuracy() elif metric == "top5accuracy" or metric == "top5acc": return metrics.Top5Accuracy() elif metric == "mae": return MAE() elif metric == "auc": return metrics.AUC() elif metric == "loss": return Loss() elif metric == "treennaccuracy": return TreeNNAccuracy() else: raise TypeError("Unsupported metric: %s" % metric)