Created
December 10, 2017 19:20
-
-
Save ivylee/b2f47d1ad787d7f7079c596bb0ac9c0f to your computer and use it in GitHub Desktop.
Visualize training scatter plots using Visdom
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
python -m visdom.server -p 8080 |
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 visualize | |
plot = visualize.Plot("Model A") | |
plot.register_scatterplot("Loss", "Epoch", "Loss") | |
for n in range(epoch): | |
# ... compute average loss over training data | |
plot.update_scatterplot("Loss", n + 1, loss) |
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 numpy | |
from visdom import Visdom | |
class Plot(object): | |
def __init__(self, title, port=8080): | |
self.viz = Visdom(port=port) | |
self.windows = {} | |
self.title = title | |
def register_scatterplot(self, name, xlabel, ylabel): | |
win = self.viz.scatter( | |
X=numpy.zeros((1, 2)), | |
opts=dict(title=self.title, markersize=5, xlabel=xlabel, ylabel=ylabel) | |
) | |
self.windows[name] = win | |
def update_scatterplot(self, name, x, y): | |
self.viz.updateTrace( | |
X=numpy.array([x]), | |
Y=numpy.array([y]), | |
win=self.windows[name] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
The updateTrace function was deprecated over six months ago. The code gives this error: