fastkde.plot Example
This notebook demonstrates basic usage of fastkde.plot.
import numpy as np
try:
import fastkde
except:
# install fastkde if not already installed
!pip install fastkde
import fastkde
For this example, we will generate data with the following relationships:
$$ x := \mathcal{N}(0,1)$$ $$ y := \mathcal{N}(x,1)$$ $$ z := \mathcal{N}(3x + 2y, 0.2)$$
""" Sample the three variables """
N = int(1e4)
x = np.random.normal(size=N)
y = x + np.random.normal(scale=1, size=N)
z = 3 * x + 2 * y + np.random.normal(scale=0.2, size=N)
""" Demonstrate the fastkde.pair_plot function """
fastkde.pair_plot([x, y, z], var_names=["x", "y", "z"])
""" Demonstrate the pair_plot function, plotting conditional distributions """
fastkde.pair_plot([x, y, z], var_names=["x", "y", "z"], conditional=True)