Skip to content

Instantly share code, notes, and snippets.

Avatar
🦏
Working from home

Ilya Orson IlyaOrson

🦏
Working from home
View GitHub Profile
@kimlaberinto
kimlaberinto / make_animation.jl
Created Apr 12, 2021
Klein Bottle Math Politcal Compass meme animation (Julia)
View make_animation.jl
## Source for math political compass klein bottle meme by @KimPLab on Twitter
## Tweet: https://twitter.com/KimPLab/status/1381621398636949511
## Inspired by the math political compass torus meme by @jessebett
## https://twitter.com/jessebett/status/1379162611414138885
## @jessebett source code notes:
## upcycled from torus knot fibration visualization:
## http://www.jessebett.com/TorusKnotFibration/torusknot.html
## Note:
@ChrisRackauckas
ChrisRackauckas / neural_ode_benchmarks.md
Last active Dec 14, 2020
torchdiffeq vs Julia DiffEqflux Neural ODE Training Benchmark
View neural_ode_benchmarks.md

torchdiffeq vs Julia DiffEqFlux Neural ODE Training Benchmark

The spiral neural ODE was used as the training benchmark for both torchdiffeq (Python) and DiffEqFlux (Julia) which utilized the same architecture and 500 steps of ADAM. Both achived similar objective values at the end. Results:

  • DiffEqFlux defaults: 7.4 seconds
  • DiffEqFlux optimized: 2.7 seconds
  • torchdiffeq: 288.965871299999 seconds
@ChrisRackauckas
ChrisRackauckas / diffeqflux_differentialequations_vs_torchdiffeq_results.md
Last active Jul 10, 2021
torchdiffeq (Python) vs DifferentialEquations.jl (Julia) ODE Benchmarks (Neural ODE Solvers)
View diffeqflux_differentialequations_vs_torchdiffeq_results.md

Torchdiffeq vs DifferentialEquations.jl (/ DiffEqFlux.jl) Neural ODE Compatible Solver Benchmarks

Only non-stiff ODE solvers are tested since torchdiffeq does not have methods for stiff ODEs. The ODEs are chosen to be representative of models seen in physics and model-informed drug development (MIDD) studies (quantiative systems pharmacology) in order to capture the performance on realistic scenarios.

Summary

Below are the timings relative to the fastest method (lower is better). For approximately 1 million ODEs and less, torchdiffeq was more than an order of magnitude slower than DifferentialEquations.jl

@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active Oct 18, 2021
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`
View aws-lambda-relative-import-no-known-parent-package.md

Python relative imports in AWS Lambda fail with attempted relative import with no known parent package

The Problem

In AWS Lambda if I attempt an explicit relative import like this

.
├── lambda_file.py
└── example.py
@sanzoghenzo
sanzoghenzo / compare.py
Last active Sep 18, 2021
Compare Excel sheets with Pandas
View compare.py
"""
Compare two Excel sheets
Inspired by https://pbpython.com/excel-diff-pandas-update.html
For the documentation, download this file and type:
python compare.py --help
"""
import argparse
import pandas as pd
View A hack for showing LaTeX formulas in GitHub markdown.md

Problem

A lot of GitHub projects need to have pretty math formulas in READMEs, wikis or other markdown pages. The desired approach would be to just write inline LaTeX-style formulas like this:

$e^{i \pi} = -1$

Unfortunately, GitHub does not support inline formulas. The issue is tracked here.

Investigation

View local.py
"""Provides methods around syncing and usage of AWS s3 buckets as local caches rather than individually
downloading every file"""
import os
import shutil
import boto3 as boto
import multiprocessing
import copy
import hashlib
@mbostock
mbostock / .block
Created Aug 11, 2017
Municipalities of Mexico II
View .block
border: no
height: 600
license: gpl-3.0
@karpathy
karpathy / pg-pong.py
Created May 30, 2016
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
View pg-pong.py
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@brendanvinson
brendanvinson / L.TopoJSON.js
Last active Sep 30, 2020 — forked from rclark/L.TopoJSON.js
TopoJSON Leaflet plugin
View L.TopoJSON.js
/*
First run npm install topojson --save and then link "node_modules/topojson/build/topojson.min.js"
above this snippet in your html.
Usage: http://leafletjs.com/reference.html#geojson
*/
L.TopoJSON = L.GeoJSON.extend({
addData: function (data) {
var geojson, key;