Skip to main content

shadyquant😎

GitHub PyPI version

This python package allows you to quantile and plot lines where you have multiple samples, typically for visualizing uncertainty. Your data should be shaped (N, T), where N is the number of samples, T is the dimension of your lines.

Install

pip install shadyquant

Example

Consider you have 100 lines that you want to compute confidence intervals (quantiles) on:

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0,2,1000)
y = np.sin(x)
plt.plot(x,y)

image

w = np.random.normal(size=100)**2
traj = y + y * w[:, None]
plt.plot(traj.T, color='C0')
plt.show()

image

You can use shadyquant to plot a 95% confidence interval:

import sq
sq.traj_quantile(traj)

image

You can also do weighted quantiling if you have weights attached to each line

sq.traj_quantile(traj, weights=w)

image

You may want to do fancy shading, which just plots a series of quantiles as polygons with transparency. The quantils overlap, which gives a nice blending. The outer edges of the polygons still correspond to the 95% confidence interval

sq.traj_quantile(traj, fancy_shading=True)

image

Here are some further options you can modify:

plt.figure(figsize=(8, 3))
ax = plt.gca()
sq.traj_quantile(
    traj,
    ax=ax,
    fancy_shading=True,
    lower_q_bound=1 / 3,
    upper_q_bound=2 / 3,
    levels=100,
    color="red",
    alpha=0.01,
)

image

Metadata

Release files for shadyquant 0.1.0

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

Source distribution (sdist)

Source distribution for shadyquant 0.1.0
File Size Uploaded
shadyquant-0.1.0.tar.gz 4.1 kB Details

Built distribution (wheel)

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

Total release size: 8.5 kB

Release files / shadyquant-0.1.0.tar.gz

Download URL shadyquant-0.1.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0fe11c2a90d9ebe5a90a1c107d4da2abe54cae066fcd0b03af63444efeafae81
BLAKE2b-256 checksum
How to use checksums
02673010ff99f4393d983185f042e8d71a2a302d15cf80c7968064335c36d551
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / shadyquant-0.1.0-py3-none-any.whl

Download URL shadyquant-0.1.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46823ca4156a33dcd1706c7e1e0a19ccefb484fa764f3f175532d6fa185961f6
BLAKE2b-256 checksum
How to use checksums
02f145e282cb7dd66384801ddc553cbcfacc5c62912d9a68e77491ae228620e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.1.0 This release

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