Skip to content

Instantly share code, notes, and snippets.

@ivylee
Created December 10, 2017 19:20
Show Gist options
  • Save ivylee/b2f47d1ad787d7f7079c596bb0ac9c0f to your computer and use it in GitHub Desktop.
Save ivylee/b2f47d1ad787d7f7079c596bb0ac9c0f to your computer and use it in GitHub Desktop.
Visualize training scatter plots using Visdom
python -m visdom.server -p 8080
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)
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]
)
@salihkaragoz
Copy link

Hello,
The updateTrace function was deprecated over six months ago. The code gives this error:

'Visdom' object has no attribute 'updateTrace'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment