Skip to main content

dbViz — Decision Boundary Visualizer

Minimal install and quickstart to plot decision boundaries for PyTorch models.

Installation

uv sync

Quickstart

A tiny example that selects three samples, builds a plane loader, and plots decision boundaries:

import torch
import torchvision
import torchvision.transforms as transforms
from dbviz.utils import get_random_samples, make_plane_loader
from dbviz.plot import plot_decision_boundaries
import matplotlib.pyplot as plt

# 1. Load a dataset
transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010))])
testset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=transform)
classes = ('plane', 'car', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck')

# 2. Load a model (using an untrained model for this example)
model = torchvision.models.resnet18(weights=None, num_classes=10)
model.eval()

# 3. Pick three samples from your dataset
cifar10_samples, cifar10_labels = get_random_samples(testset)

# 4. Build a plane loader
plane_loader = make_plane_loader(cifar10_samples, batch_size=256, plane_size=500)

# 5. Plot and save
fig = plot_decision_boundaries(model, cifar10_labels, plane_loader, num_classes=len(classes), plane_size=500)
fig.savefig('decision_boundaries_cifar10.png')
plt.show()

Acknowledgement

This package is inspired by:

Release files for dbviz 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dbviz 0.1.5
File Size Uploaded
dbviz-0.1.5.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dbviz 0.1.5
File Interpreter ABI Platform
dbviz-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 18.1 kB

Release files / dbviz-0.1.5.tar.gz

Download URL dbviz-0.1.5.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c6f2f39b4e880df29ec31c8dedab4e7c4bce4e64067280dd4ecaeba2d41fb7dc
BLAKE2b-256 checksum
How to use checksums
1158f4edc6c322e764ba0d70ae4925f517f4e95dd07b8aa36863328656630fb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2025.

Transparency log

Release files / dbviz-0.1.5-py3-none-any.whl

Download URL dbviz-0.1.5-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f7839a4ca90c1e683534831b6b6642ea6d7da16f9a091324812add6708ec3f2
BLAKE2b-256 checksum
How to use checksums
d506357584608cacebd097f109e84e5e83a1356a8e40e398f9427dbe43c806b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page