gpflux.callbacks#
This module implements a callback that enables GPflow’s gpflow.monitor.ModelToTensorBoard to
integrate with Keras’s tf.keras.Model‘s fit method.
Module Contents#
- class TensorBoard(log_dir: str = 'logs', *, keywords_to_monitor: List[str] = ['kernel', 'mean_function', 'likelihood'], max_size: int = 3, histogram_freq: int = 0, write_graph: bool = True, write_images: bool = False, update_freq: int | str = 'epoch', profile_batch: int = 2, embeddings_freq: int = 0, embeddings_metadata: Dict | None = None)[source]#
Bases:
gpflow.keras.tf_keras.callbacks.TensorBoardThis class is a thin wrapper around a
tf.keras.callbacks.TensorBoardcallback that also calls GPflow’sgpflow.monitor.ModelToTensorBoardmonitoring task.- Parameters:
log_dir – The path of the directory to which to save the log files to be read by TensorBoard.
keywords_to_monitor – A list of keywords to monitor. If the parameter’s name includes any of the keywords specified, it will be added to the TensorBoard.
max_size – The maximum size of arrays (inclusive) for which each element is written independently as a scalar to the TensorBoard.
For information on all other arguments, see TensorFlow’s TensorBoard callback docs.
- log_dir: str[source]#
The path of the directory to which to save the log files to be read by TensorBoard. Files are saved in
log_dir / "train", following the Keras convention.
- keywords_to_monitor: List[str][source]#
Parameters whose name match a keyword in the keywords_to_monitor list will be added to the TensorBoard.
- update_freq: int | str[source]#
Either an integer or
"epoch". If using an integer n, write losses/metrics/parameters at every nth batch; when using"epoch", write them at the end of each epoch. Note that writing too frequently to TensorBoard can slow down the training.
- set_model(model: gpflow.keras.tf_keras.Model) None[source]#
Set the model (extends the Keras set_model method).
This method initialises
KerasModelToTensorBoardand mimics Keras’s TensorBoard callback in writing the summary logs tolog_dir/ “train”.