Skip to content

libvis/python-libvis

Repository files navigation

https://libvis.dev/libvis-sm.png

PyPi version

libvis.dev

Live data visualization

This project allow live and interactive visualization of python variables in a web dashboard application. Data is sent both ways: you can visualize and update the variables while running another code.

Machine learning visualization:

assets/torch_adv_demo.gif

Example notebooks are:

Quick start.

Quick start

from libvis import Vis
import time

vis = Vis()
vis.show() # Opens the browser on 7000 port

# Live plotting
for i in range(0,100):
   vis.vars.line = [(2**x)%100 for x in range(i)]
   time.sleep(.2)

You should see a live plot of the vis.vars.line object.

Libvis is a live object visualization tool, best used with jupyter notebook.

Natively supported variables:

  • 1-d array -> line plot
  • tuple of 2 1-d arrays -> line plot with custom x-values
  • 2-d array -> image
  • matplotlib and seaborn figures
  • bokeh figures

See notebooks/test for more detailed usage.

Use cases

Machine learning visualization

Using as a live visualization of machine learning training.

Features:

  • Live loss plot
  • Learning rate adjustments while training
  • Live histograms of gradients/weights
  • Real-time confusion matrix for each training batch

Demo notebooks:

assets/torch_adv_demo.gif

How this works?

A separate thread is created that checks the changes. No network requests performed in main thread.

The overhead is negligible, most of the time libvis spends waiting for updates. There are two ways to send updates to front:

Watch a variable

This approach is useful for rapidly-updating or large data. It periodically sends updates about a mutable variable.

mylist = []
vis.watch(mylist, 'mylist')

mylist.append(2) # will be sent every 0.2 seconds by default

Update by setting an attribute

This approach is good when you want faster update speeds and don't have updates very frequently. Each time a live object is assigned an attribute, the updates are scheduled to sending.

image = libvis.modules.insatlled.Image()
vis.vars.image = image
image.data = test_data # sends data (almost) immediately

Documentation

http://docs.libvis.dev

About

Interactive live object visualization for python

Resources

Stars

Watchers

Forks

Packages

No packages published