I have a custom function which plots the results from a neural network, thus:
and I want to display the model.summary()
, as in
Model: "sequential_35"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
dense_140 (Dense) (None, 15) 150
_________________________________________________________________
dense_141 (Dense) (None, 15) 240
_________________________________________________________________
dense_142 (Dense) (None, 15) 240
_________________________________________________________________
dense_143 (Dense) (None, 1) 16
=================================================================
Total params: 646
Trainable params: 646
Non-trainable params: 0
_________________________________________________________________
in the upper left corner of the second ax
for recording purposes. My custom plotting function includes:
def plot_delta_z_hist(values, datasetname, summary, ax = None):
...
...
...
at = AnchoredText(
"{0}".format(summary), prop=dict(size=10), frameon=True, loc='upper left')
at.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
ax.add_artist(at)
and I call it like
qf.plot_delta_z_hist(valid_dataset['Delta z'], datasetname, model.summary(), ax[1])
but as you can see, it just displays None
where the summary should be. How can I pass the model.summary()
into the plotting function so that it displays there?