Created
April 16, 2021 02:08
-
-
Save rsokl/c7e2ed1aab02b35208bb5b4c8051a931 to your computer and use it in GitHub Desktop.
A code snippet for plotting a job from hydra-zen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot_jobs(*jobs, fn): | |
import numpy as np | |
import matplotlib.pyplot as plt | |
(jobs,) = jobs | |
x, y = np.arange(-2, 2, 0.1), np.arange(-2, 2, 0.1) | |
X, Y = np.meshgrid(x, y) | |
V = parabaloid(X, Y) | |
fig, ax = plt.subplots() | |
ax.contour(X, Y, V.reshape(X.shape), levels=[0.01, 0.12, 0.3, 0.5], colors="black") | |
for job in jobs[0]: | |
title, label = job.hydra_cfg.hydra.overrides.task[0].split("=") | |
ax.plot( | |
*job.return_value.T, | |
label=label, | |
) | |
ax.legend(title=title) |
Author
rsokl
commented
Apr 16, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment