Skip to content

Instantly share code, notes, and snippets.

View jzelner's full-sized avatar

Jon Zelner jzelner

View GitHub Profile
#a simple network-based SIR model written in Python
#Jon Zelner
#University of Michigan
#August 11, 2009
import sys, getopt
from igraph2Sonia import igraph2sonia
#for networks
def main():
def usage():
#a simple network-based SIR model written in Python
#Jon Zelner
#University of Michigan
#August 11, 2009
import sys, getopt
from igraph2Sonia import igraph2sonia
#for networks
def main():
def usage():
#a simple network-based SIR model written in Python
#Jon Zelner
#University of Michigan
#August 11, 2009
import sys, getopt
from igraph2Sonia import igraph2sonia
#for networks
def main():
def usage():
#a simple SIR model written in Python
#Jon Zelner
#University of Michigan
#October 8, 2009
#import random number and plotting libraries
import random
import pylab as pl
#set quantities of individuals in each state
#A simple SIR model written in Python
#Jon Zelner
#University of Michigan
#October 8, 2009
#Ok, so first we're going to import our random number and plotting libraries
# this is Python's standard random number library.
#For heavy-duty applications you'll want to use something else
#(like Scipy) but for this example, this will be more than adequate.
#A simple SIR model written in Python
#Jon Zelner
#University of Michigan
#October 8, 2009
#Ok, so first we're going to import our random number and plotting libraries
# this is Python's standard random number library.
#For heavy-duty applications you'll want to use something else
#(like Scipy) but for this example, this will be more than adequate.
#a simple object-based SIR model written in Python
#Jon Zelner
#University of Michigan
#October 20, 2009
#import 'sirWithClasses' to use the components of this model as you wish
#or just run this script as 'python sirWithClasses.py' to do a sample model run
import random
import heapq
#a simple network-based SIR model written in Python
#Jon Zelner
#University of Michigan
#October 20, 2009
#import this file (networkSIRWithClasses) to use the model components
#or run as 'python networkSIRWithClasses.py' to do sample runs
import igraph
import random
import random
import scipy
import pylab as pl
pl.figure()
for i in range(30):
S = 99999
I = 1
R = 0
@jzelner
jzelner / hmm.py
Created December 12, 2012 12:25
Example of the Forward-Backward algorithm implemented using Theano
#Forward-backward algorithm implementation in Theano,
#with example taken from Wikipedia:
#http://en.wikipedia.org/wiki/Forward%E2%80%93backward_algorithm
import theano
import theano.tensor as T
import numpy as np
#Set up vectors, etc to represent
#observations, indexes into the observation