Skip to content

Instantly share code, notes, and snippets.

View jzelner's full-sized avatar

Jon Zelner jzelner

View GitHub Profile
@jzelner
jzelner / Multinomial_Logit_HMM.py
Last active August 30, 2016 20:33
Example of time-varying HMM transition matrix
import numpy as np
#A simple observation series
obs = np.array([0, 0, 1, 0, 0])
#initial state occupation probabilities
#(flat prior over state occupancies when t = 0)
initProbs = np.ones(4)/4
#These are the time-constant transition *rates* (with zeros
#!/usr/bin/env Rscript
input <- commandArgs(trailingOnly = TRUE)
KnitPost <- function(input, base.url = "/") {
require(knitr)
opts_knit$set(base.url = base.url)
fig.path <- paste0("../figs/", sub(".Rmd$", "", basename(input)), "/")
opts_chunk$set(fig.path = fig.path)
opts_chunk$set(fig.cap = "center")
render_jekyll()
#!/bin/bash
FILE="${1}"
if [[ $# != 1 ]]; then
echo "Usage: ./render_post.sh <file>"
exit
fi
if [[ ! -f "${FILE}" ]]; then
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<style>
.enter {
fill: green;
}
.update {
# ipak function: install and load multiple R packages.
# check to see if packages are installed. Install them if they are not, then load them into the R session.
ipak <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg, dependencies = TRUE)
sapply(pkg, require, character.only = TRUE)
}