Skip to content

Instantly share code, notes, and snippets.

View YannDubs's full-sized avatar
🦙

Yann Dubois YannDubs

🦙
View GitHub Profile
@YannDubs
YannDubs / interactive_bezier_curves.py
Created September 5, 2022 02:11
Interactive Bezier curve builder for jupyter notebook
%matplotlib widget # need to install ipympl
import numpy as np
from matplotlib.lines import Line2D
from matplotlib.artist import Artist
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
import numpy as np
@YannDubs
YannDubs / statify_sampling.py
Created March 9, 2019 23:05
Stratify sampling using numpy
def stratify_sampling(x, n_samples, stratify):
"""Perform stratify sampling of a tensor.
parameters
----------
x: np.ndarray or torch.Tensor
Array to sample from. Sampels from first dimension.
n_samples: int
Number of samples to sample