Skip to main content

A minimal library for plotting training progress in Jupyter/Colab

Project description

tinyGraphs

A minimal library for plotting training progress in Jupyter/COLAB notebooks.

Installation

pip install tinyGraphs

Options

train_losses: List of training loss values to plot \n val_losses: List of validation loss values to plot \n epoch: Current epoch number for updating the plot \n legend_loc: Location of the legend on the plot (default: "upper right") \n updating_title: Boolean flag to indicate if the title should update with epoch progress (default: True) \n legend: Boolean flag to show/hide the legend (default: True) \n x_label: Label for the x-axis \n y_label: Label for the y-axis \n title: Main title of the plot \n dark_mode: Boolean flag to switch between light and dark themes (default: True) \n

Usage

train_losses, val_losses = [], []
epochs = 3

for epoch in range(epochs):
    # Training
    model.train()
    running_train_loss = 0
    for x, y in train_loader:
        x, y = x.to(device), y.to(device)
        optimizer.zero_grad()
        loss = criterion(model(x), y)
        loss.backward()
        optimizer.step()
        running_train_loss += loss.item()
    train_losses.append(running_train_loss / len(train_loader))

    # Validation
    model.eval()
    running_val_loss = 0
    with torch.no_grad():
        for x, y in val_loader:
            x, y = x.to(device), y.to(device)
            loss = criterion(model(x), y)
            running_val_loss += loss.item()
    val_losses.append(running_val_loss / len(val_loader))

    # Plot using tinyGraphs
    plot(train_losses, val_losses, epoch, legend_loc = "upper right", updating_title = False, legend = True, x_label = "x title", y_label = "y title", title = "title", dark_mode = False)

Other Usage Options

    plot(train_losses, val_losses, epoch, legend_loc = "upper right", updating_title = False, legend = True, x_label = "Epoch", y_label = "Loss", title = "Loss Graph", dark_mode = True)

Dark Mode!

    plot(train_losses, val_losses, epoch, color_scheme = 'jet')

Beautiful Loss Graph With Barely Any Code!

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

tinygraphs-0.0.4.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

tinygraphs-0.0.4-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file tinygraphs-0.0.4.tar.gz.

File metadata

  • Download URL: tinygraphs-0.0.4.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for tinygraphs-0.0.4.tar.gz
Algorithm Hash digest
SHA256 ffb7df63c7fa7dea38bf0915e26f708855d319ae20c3571f7ca66e8e89b5e9ba
MD5 b9b1c4aa081de1719a3b822be883cdb3
BLAKE2b-256 7204313eeff3602df6061d397e279e85966fbf454d4bb38dc1bbd4db0e93cb68

See more details on using hashes here.

File details

Details for the file tinygraphs-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: tinygraphs-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for tinygraphs-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8a6a9b80dce3d0cf01bfc856b1836e0f5ca4f3290cc3a228752e6eb1034d92cf
MD5 aaa1a0823c85911486067be94cc1c8ec
BLAKE2b-256 89b8bdda60980b35e22291d820f37b7cc7ea75a0cc709f0ccd2c73c30b9471db

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