Skip to content

Instantly share code, notes, and snippets.

View annawoodard's full-sized avatar

Anna Woodard annawoodard

  • University of Chicago
  • Chicago, USA
View GitHub Profile
@rmcelreath
rmcelreath / prior_likelihood_conflict.r
Created September 11, 2023 11:29
Demonstration of how normal and student-t distributions interact in Bayesian updating
# prior - likelihood conflict
library(rethinking)
yobs <- 0
mtt <- ulam(
alist(
y ~ dstudent(2,mu,1),
mu ~ dstudent(2,10,1)
import torch
from torch.utils._python_dispatch import TorchDispatchMode
from torch.utils._pytree import tree_map
import itertools
# cribbed from https://github.com/albanD/subclass_zoo/blob/main/logging_mode.py
class Lit:
def __init__(self, s):
self.s = s
@PubuduSaneth
PubuduSaneth / 01.Format_gencode_gff3.ipynb
Created December 24, 2018 09:21
Annotating gene coordinates and gene lists - python way
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@L0SG
L0SG / freeze_example.py
Last active October 12, 2023 05:02
PyTorch example: freezing a part of the net (including fine-tuning)
import torch
from torch import nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
# toy feed-forward net
class Net(nn.Module):
def __init__(self):
@MInner
MInner / gpu_profile.py
Created September 12, 2017 16:11
A script to generate per-line GPU memory usage trace. For more meaningful results set `CUDA_LAUNCH_BLOCKING=1`.
import datetime
import linecache
import os
import pynvml3
import torch
print_tensor_sizes = True
last_tensor_sizes = set()
gpu_profile_fn = f'{datetime.datetime.now():%d-%b-%y-%H:%M:%S}-gpu_mem_prof.txt'
from graphviz import Digraph
import torch
from torch.autograd import Variable, Function
def iter_graph(root, callback):
queue = [root]
seen = set()
while queue:
fn = queue.pop()
if fn in seen:
@spott
spott / beemind.py
Created April 17, 2017 21:45
A script for dealing with beeminding a thesis.
#!/usr/local/bin/python3
import requests
import hashlib
import time as tt
import ast
import os
import sys
folder = '<where_your_thesis_is>'
@evansde77
evansde77 / setup.sh
Last active December 5, 2016 23:19
Python Environment Setup on MacOSX
#!/bin/bash
# assumes that XCode and XCode command line tools have been installed
# xcode-select --install
# assumes that gfortran has been installed
# https://gcc.gnu.org/wiki/GFortranBinaries
# install pyenv & set 2.7.11 as current
# See: https://github.com/yyuu/pyenv-installer
# See: https://github.com/yyuu/pyenv
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
@manugarri
manugarri / parking map.ipynb
Created February 21, 2016 21:19
Where the f*** can I park?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@markfink
markfink / game_of_life_32x64.ino
Last active July 28, 2017 04:49
Arduino Conway's Game of Life on 32 x 62 LED Matrix
// Conway's Game Of Life 32 x 64
// based on https://github.com/markfink/GoL_Javascript
#include <avr/pgmspace.h>
#include "pins_arduino.h"
// Connections to board
const byte pinSTB=7;
const byte pinClock=12;
const byte pinURed=10;
const byte pinUGreen=11;