Set default values for metrics for regression and networks

This commit is contained in:
Fabio Manganiello 2020-03-23 01:10:59 +01:00
parent 50e372be36
commit f4dcf688f0
1 changed files with 8 additions and 2 deletions

View File

@ -238,7 +238,7 @@ class TensorflowPlugin(Plugin):
you could also pass a dictionary, such as you could also pass a dictionary, such as
``metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}``. You can also pass a list ``metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}``. You can also pass a list
``(len = len(outputs))`` of lists of metrics such as ``metrics=[['accuracy'], ['accuracy', 'mse']]`` or ``(len = len(outputs))`` of lists of metrics such as ``metrics=[['accuracy'], ['accuracy', 'mse']]`` or
``metrics=['accuracy', ['accuracy', 'mse']]``. ``metrics=['accuracy', ['accuracy', 'mse']]``. Default: ``['accuracy']``.
:param loss_weights: Optional list or dictionary specifying scalar coefficients (Python floats) to weight the :param loss_weights: Optional list or dictionary specifying scalar coefficients (Python floats) to weight the
loss contributions of different model outputs. The loss value that will be minimized by the model loss contributions of different model outputs. The loss value that will be minimized by the model
@ -370,6 +370,9 @@ class TensorflowPlugin(Plugin):
layer = self._layer_from_dict(layer.pop('type'), **layer) layer = self._layer_from_dict(layer.pop('type'), **layer)
model.add(layer) model.add(layer)
if not metrics:
metrics = ['accuracy']
model.compile( model.compile(
optimizer=optimizer, optimizer=optimizer,
loss=loss, loss=loss,
@ -433,7 +436,7 @@ class TensorflowPlugin(Plugin):
you could also pass a dictionary, such as you could also pass a dictionary, such as
``metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}``. You can also pass a list ``metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}``. You can also pass a list
``(len = len(outputs))`` of lists of metrics such as ``metrics=[['accuracy'], ['accuracy', 'mse']]`` or ``(len = len(outputs))`` of lists of metrics such as ``metrics=[['accuracy'], ['accuracy', 'mse']]`` or
``metrics=['accuracy', ['accuracy', 'mse']]``. ``metrics=['accuracy', ['accuracy', 'mse']]``. Default: ``['mae', 'mse']``.
:param loss_weights: Optional list or dictionary specifying scalar coefficients (Python floats) to weight the :param loss_weights: Optional list or dictionary specifying scalar coefficients (Python floats) to weight the
loss contributions of different model outputs. The loss value that will be minimized by the model loss contributions of different model outputs. The loss value that will be minimized by the model
@ -501,6 +504,9 @@ class TensorflowPlugin(Plugin):
else: else:
model.output_labels = [] model.output_labels = []
if not metrics:
metrics = ['mae', 'mse']
model.compile( model.compile(
optimizer=optimizer, optimizer=optimizer,
loss=loss, loss=loss,