Save graphs from executionsΒΆ

Collecting metadata allows you to easily visualize your key performance metrics as a time series graph or a scatter plot.

You can also generate more complex graphs inside your execution and save them as Valohai outputs.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
import matplotlib.pyplot as plt
import numpy as np
import valohai

np.random.seed(19680801)
data = np.random.randn(2, 100)

fig, axs = plt.subplots(2, 2, figsize=(5, 5))
axs[0, 0].hist(data[0])
axs[1, 0].scatter(data[0], data[1])
axs[0, 1].plot(data[0], data[1])
axs[1, 1].hist2d(data[0], data[1])

save_path = valohai.outputs().path('myplot.png')
plt.savefig(save_path)

plt.show()
plt.close()