Created
May 12, 2021 09:00
-
-
Save basnijholt/d87d691237e0f1ec87745c95e581a4a8 to your computer and use it in GitHub Desktop.
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
import matplotlib.tri as mtri | |
from matplotlib import pyplot as plt | |
def plot_loss(learner, cmap="viridis", xy_size=(10, 10)): | |
fig, ax = plt.subplots(figsize=xy_size) | |
x_size, y_size = xy_size | |
ip = learner.ip() | |
zs = learner.loss_per_triangle(ip) | |
tri = ip.tri | |
xs, ys = tri.points.T | |
x_size, y_size = xy_size | |
triang = mtri.Triangulation(x_size * xs, y_size * ys, triangles=tri.vertices) | |
ax.triplot(triang, c="k", lw=0.3, alpha=1, zorder=2), (ip.values, triang) | |
im = ax.tripcolor(triang, zs.flatten(), zorder=0, cmap=cmap) | |
plt.colorbar(im) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example result: