Skip to main content

Dynamically updating plots in Jupyter notebooks, e.g. for visualizing training progress.

Project description

trainplot

Dynamically updating plots in Jupyter notebooks, e.g. for visualizing machine learning training progress.

pip install trainplot

Usage

Basic usage:

from trainplot import plot

for i in range(100):
    loss = ...
    acc = ...
    plot(loss=loss, accuracy=acc)

If you use keras, you can use the TrainPlotKerasCallback:

from trainplot import TrainPlotKeras

model = ...
model.fit(x_train, y_train, validation_data=(x_test, y_test), epochs=10, callbacks=[TrainPlotKerasCallback()])

For more examples, see the examples folder.

Features

  • Lightweight: No external plotting dependencies
  • Custom rendering: Uses HTML5 Canvas for fast, smooth updates
  • Multiple series: Automatically handles multiple data series with different colors
  • Real-time updates: Configurable update periods to balance performance and responsiveness
  • Keras support: Built-in callback for TensorFlow/Keras models

How it works

Trainplot uses a custom HTML5 Canvas-based plotting solution that renders directly in Jupyter notebooks. For synchronization between Python and the JavaScript-based plotting function, anywidget is used. To avoid wasting resources and flickering, the plot is only updated with a given update_period. A post_run_cell callback is added to the IPython instance, so that all updated TrainPlot figures include all new data when a cell execution is finished. When using trainplot.plot, a TrainPlot object is created for the current cell.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trainplot-0.4.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trainplot-0.4.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file trainplot-0.4.0.tar.gz.

File metadata

  • Download URL: trainplot-0.4.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for trainplot-0.4.0.tar.gz
Algorithm Hash digest
SHA256 de99eb59f299b5fd30ea25737e39f5118bc51e4db125ccf84941158b5e7a1244
MD5 e9db45b85721aabb80af29aa4342fd3e
BLAKE2b-256 90505bc57808b7d808009d58401abf274bcd5b2416851337399359fee917c986

See more details on using hashes here.

File details

Details for the file trainplot-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: trainplot-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for trainplot-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59e1d1fde3155a8771ce9ae015de65b7bb37460fb727c857d15f742dd0865d4c
MD5 a57dec442ca1befcf065f6160c639acb
BLAKE2b-256 265426b64a96256647d450630bff373dba9554457c4b555f85233dc510520166

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page