This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin python | |
# -*- coding:utf-8 -*- | |
""" | |
""" | |
import os | |
import h5py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import matplotlib.font_manager as plt_fm | |
class PltFontManager: | |
""" | |
Sometimes matplotlib finds the system font paths, but setting them can | |
still be challenging due to using the wrong name or matplotlib complaining | |
about missing elements. | |
This manager static class is intended to aid with that, by facilitating |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
import random | |
class SubsetSampler(torch.utils.data.Sampler): | |
""" | |
Like ``torch.utils.data.SubsetRandomsampler``, but without the random, | |
and with the possibility of balanced sampling. Samples a subset of the | |
given dataset from a given list of indices, without replacement. | |
Usage example:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*-coding:utf-8-*- | |
""" | |
This module contains 2 functions: | |
* ``cose_recovery``: Implements the L1 compressed sensing program, allowing | |
for L2 error tolerance in the constraint. | |
* ``cose_recovery_mpp``: Parallelized version of ``cose_recovery`` that runs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
""" | |
!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
The quantities computed in this gist are wrong. While a correction is | |
pending, see the following discussion for more details. The TLDR is that | |
they must be divided by batch_size^2, or use the alternative Cockpit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*-coding:utf-8-*- | |
""" | |
This module contains a minimal example to illustrate one of the main | |
implications of the compressed sensing paradigm: That a perfect recovery of a | |
sparse signal is possible with a number of measurements that depends on the | |
signal sparsity, and not on the signal length. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interactive_gpu() | |
{ | |
# needed by getopt: https://stackoverflow.com/a/5048356 | |
local OPTIND | |
# default parameter values | |
seconds=300 | |
partition="large" | |
# parse flags to optionally override param defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
""" | |
Most existing breadth-first search implementations provide a solution to | |
*traverse* a tree, but they don't *return* that specific tree. This module | |
provides a tree datastructure and BFS implementation to obtain the BFS tree. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
""" | |
""" | |
import librosa | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jax.numpy as jnp | |
from jax import jit, value_and_grad | |
from jax.config import config | |
config.update("jax_debug_nans", True) | |
class RegularInv1dSampler: | |
""" | |
This regular inverse sampler deals with the following problem: given a | |
smooth function ``y=f(x)`` for ``x`` scalar and ``y`` n-dimensional, | |
retrieve ``N`` monotonically increasing values of ``x``, such that the |
NewerOlder