Skip to content

Instantly share code, notes, and snippets.

View IlyaOrson's full-sized avatar
🦏
Wandering

Ilya Orson IlyaOrson

🦏
Wandering
View GitHub Profile
@kimlaberinto
kimlaberinto / make_animation.jl
Created April 12, 2021 14:56
Klein Bottle Math Politcal Compass meme animation (Julia)
## 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:
@gizmaa
gizmaa / Plot_Examples.md
Last active April 12, 2024 14:18
Various Julia plotting examples using PyPlot
@sanzoghenzo
sanzoghenzo / compare.py
Last active April 12, 2024 04:48
Compare Excel sheets with Pandas
"""
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
@ChrisRackauckas
ChrisRackauckas / diffeqflux_vs_jax_results.md
Last active April 9, 2024 00:57
DiffEqFlux.jl (Julia) vs Jax on an Epidemic Model

DiffEqFlux.jl (Julia) vs Jax on an Epidemic Model

The Jax developers optimized a differential equation benchmark in this issue which used DiffEqFlux.jl as a performance baseline. The Julia code from there was updated to include some standard performance tricks and is the benchmark code here. Thus both codes have been optimized by the library developers.

Results

Forward Pass

@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" 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
@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active March 15, 2024 14:13
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`

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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ChrisRackauckas
ChrisRackauckas / diffeqflux_differentialequations_vs_torchdiffeq_results.md
Last active December 20, 2023 13:10
torchdiffeq (Python) vs DifferentialEquations.jl (Julia) ODE Benchmarks (Neural ODE Solvers)

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

@brendanvinson
brendanvinson / L.TopoJSON.js
Last active September 29, 2023 00:14 — forked from rclark/L.TopoJSON.js
TopoJSON Leaflet plugin
/*
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;
@pat-alt
pat-alt / cp_sr.jl
Last active July 31, 2023 09:50
Symbolic Regression with Conformal Prediction Intervals.
using ConformalPrediction
using Distributions
using MLJ
using Plots
# Inputs:
N = 600
xmax = 3.0
d = Uniform(-xmax, xmax)