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 | |
import jax.numpy as jnp | |
import functools | |
def gmm_max(logpi, mu, cov): | |
"""Return an upper bound the GMM density | |
logpi: (K,)-array of the log-weights | |
mu: (K, D)-array of the component means | |
cov: (K,D,D)-array of the component covarainces |
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
{- A module implementing a simple (and quite dumb) set -} | |
module MySet1 (Set, empty, toList, insert, contains) where | |
import Data.List(nub) | |
{- Set | |
A set, backed by a regular list. | |
If the list has duplicates, it is nothing the user should notice | |
-} | |
data Set a = SetC [a] |
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
/* | |
This code reads the BNO055 fast using the RPi linux kernel support for I2C. | |
for running this file as a program, compile and run! | |
gcc -o faster faster.c -O3 && ./faster | |
You can also compile as a shared lib, and then call it from python. | |
gcc -Wall -shared -o faster.so faster.c && python faster.py | |
Page number and table number references are to the BNO055 data sheet. |
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 numpy as np | |
import scipy.stats as sps | |
import matplotlib.pyplot as plt | |
from scipy.special import digamma | |
# | |
# Config | |
# | |
np.random.seed(999) | |
plt.rcParams['font.family'] = "monospace" |
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
# nice library that gives us access to the microphone | |
import pyaudio | |
# python standard libraries that come built-in | |
import threading | |
import queue | |
import wave | |
# optional libraries | |
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
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Pointers where | |
import Data.Proxy (Proxy (..)) | |
import Foreign.Marshal.Array (newArray, peekArray) | |
import Foreign.Ptr (Ptr) | |
import GHC.TypeNats (KnownNat, Nat, natVal) |
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 numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.patches import Ellipse, Rectangle | |
from matplotlib.transforms import Affine2D | |
from scipy.stats import t, f | |
from scipy.linalg import sqrtm | |
import statsmodels.api as sm | |
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
""" | |
Comparison of empirical bernstein measures | |
See https://el-hult.github.io/2022/03/18/empirical-bernstein-bounds.html | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import scipy.stats as sps | |
import pandas as pd |
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 System.IO.Unsafe ( unsafeInterleaveIO ) | |
import System.Random ( randomRIO ) | |
import Text.Printf ( printf ) | |
-- | An infinite list of random die rolls, lazily generated | |
-- | |
-- This is dangerous since calling this function steps the global random generator | |
-- not when running the action, but when accessing its result. | |
diceRolls :: IO [Int] | |
diceRolls = do |
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
# %% set up the plot | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from matplotlib.widgets import Slider | |
LOC_MAX = 2 | |
# The parametrized function to be plotted | |
def f1(t, amplitude, location): |
NewerOlder