Skip to content

Commit 1eda62c

Browse files
committed
Add support for custom metrics to MLP
1 parent 414876e commit 1eda62c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bayesflow/networks/mlp/mlp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def __init__(
2929
dropout: Literal[0, None] | float = 0.05,
3030
norm: Literal["batch", "layer"] | keras.Layer = None,
3131
spectral_normalization: bool = False,
32+
metrics: Sequence[keras.Metric] | None = None,
3233
**kwargs,
3334
):
3435
"""
@@ -60,6 +61,7 @@ def __init__(
6061
**kwargs
6162
Additional keyword arguments passed to the Keras layer initialization.
6263
"""
64+
self.custom_metrics = metrics
6365
self.widths = list(widths)
6466
self.activation = activation
6567
self.kernel_initializer = kernel_initializer
@@ -90,6 +92,7 @@ def get_config(self):
9092
"dropout": self.dropout,
9193
"norm": self.norm,
9294
"spectral_normalization": self.spectral_normalization,
95+
"metrics": self.custom_metrics,
9396
}
9497

9598
return base_config | serialize(config)

0 commit comments

Comments
 (0)