Skip to content

Instantly share code, notes, and snippets.

View jackd's full-sized avatar

Dominic Jack jackd

View GitHub Profile
@jackd
jackd / sir.py
Created August 25, 2021 09:25
A super-simple Susceptible-Infection-Recovered (SIR) model with vaccination
"""Basic Susceptible-Infectious-Recovered model."""
import numpy as np
import matplotlib.pyplot as plt
def run(
infectious: int,
r0=1.07, # base daily growth rate
vax_rate=0,
init_vax_prop=0,
@jackd
jackd / README.md
Last active January 24, 2021 14:43
Generalized eigenvalue jvp implementation in jax

After installing jax, run with:

git clone https://gist.github.com/jackd/99e012090a56637b8dd8bb037374900e
cd 99e012090a56637b8dd8bb037374900e
python dirty_test.py
@jackd
jackd / diff.html
Created November 17, 2020 07:43
testing embedly
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Diff to HTML by rtfpessoa</title>
<!--
Diff to HTML (template.html)
Author: rtfpessoa
-->
@jackd
jackd / README.md
Last active September 22, 2020 08:39
SparseTensor vs CSRSparseMatrix matmul benchmark

Sparse Mamul Benchmarks

Script for benchmarking matmuls with SparseTensor vs CSRSparseMatrix.

Installation

pip install tensorflow==2.3
pip install absl-py
git clone https://gist.github.com/jackd/93cf681c67e48c1a25de01bf860c6ab2
@jackd
jackd / README.md
Last active August 2, 2022 12:41
tensorflow graphics keras port for PR #155

Get my forked tensorflow graphics repo and switch to appropriate branch

git clone https://github.com/jackd/graphics.git
cd graphics
git checkout sparse-feastnet
pip install -e .
cd ..

Get this gist:

@jackd
jackd / main.py
Created June 23, 2019 03:59
trimesh_obj_example
import trimesh
import numpy as np
def fix_visual(visual):
from PIL import Image
if isinstance(visual, trimesh.visual.ColorVisuals):
return
material = visual.material
assert(hasattr(material, 'image'))
@jackd
jackd / main.py
Last active May 28, 2019 02:43
trimesh_obj_fallback_example
import trimesh
trimesh.load('./rabbit.obj')
@jackd
jackd / main.py
Last active December 1, 2022 09:04
Demo of trimesh loading issue with missing map_Kd
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
try:
from PIL import Image
except ImportError:
Image = None
@jackd
jackd / conf.gin
Last active May 2, 2019 23:40
gin-config keras bug
layers.Dense.kernel_regularizer = @regularizers.l2()
regularizers.l2.l = 1e-4
@jackd
jackd / cloud_data.npy
Last active March 26, 2019 13:42
trimesh issue with minimum sphere