Skip to content

Instantly share code, notes, and snippets.

View maedoc's full-sized avatar

marmaduke woodman maedoc

  • now
  • here
View GitHub Profile
@maedoc
maedoc / ahoyn.py
Created March 29, 2024 17:46
simple adaptive Heun integrator
def heun(y, t, dt):
d1 = dfun(y, t)
d2 = dfun(y + dt*d1, t + dt)
err = np.mean(np.abs((d1 - d2)))#/(1e-9+d2)))
return y + dt/2*(d1 + d2), err
def solve_adapt1(y0, ts, tol):
ys = [y0]
max_dt = dt = ts[1] - ts[0]
t0 = ts[0]
@maedoc
maedoc / ndim-visitor-jax.py
Last active December 11, 2023 13:22
Compare visiting N-dimensions with Jax scans vs pre-generated indices with NumPy meshgrid
import os
# use cpu for this
os.environ['CUDA_VISIBLE_DEVICES'] = ''
########################### numpy style
import numpy as np
n = 5
size = 4
@maedoc
maedoc / 23-11-24-localfdr.ipynb
Created November 24, 2023 13:08
a short example of local fdr outlier detection
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / 23-10-12-gain-ball-geom.ipynb
Created October 12, 2023 11:58
comparing point vs extended geometry for source sensor forward model
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / 23-10-11-taichi-test.ipynb
Created October 12, 2023 08:33
Short test of taichi on tight numerical loops
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / simple-sbi.ipynb
Created October 5, 2023 10:33
Simple examples of simulation based inference
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / discretized-linear-delays.ipynb
Last active September 11, 2023 15:08
discretized linear delays
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / µrwkv.py
Last active January 24, 2024 15:09
Another short take on RWKV, towards use with time series
import numpy as np
import torch
class MyModule(torch.nn.Module):
def add_param(self, key, shape):
val = torch.randn(*shape)/np.prod(shape)
setattr(self, key, torch.nn.Parameter(val))
@maedoc
maedoc / bayes-classifier.ipynb
Last active April 20, 2023 13:22
simple Bayesian classifier
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / cat-gpt.md
Last active April 2, 2023 07:36
cat gpt

Here's a funny image

image

gpt-4 misses it:

The humor in the image of a cat with a sign saying "GPT" in French and a caption reading "I guess it only works in French" lies in the combination of a few elements:

    Language play: The acronym "GPT" stands for "Generative Pre-trained Transformer," which is an AI language model developed by OpenAI. The joke implies that there is a French version of GPT that only works in French, even though the acronym and the technology itself are not language-specific.