Representations:
- Hierarchical models
- Hidden Markov models
- Graphical models
- Non-parametric Bayes (distributions over functions)
Inference Approaches:
# -*- coding: utf-8 -*- | |
""" | |
given a word and visualize near words | |
original source code is https://github.com/nishio/mycorpus/blob/master/vis.py | |
""" | |
import word2vec_boostpython as w2v | |
from sklearn.decomposition import PCA | |
import matplotlib.pyplot as plt | |
import matplotlib.font_manager |
""" | |
preprocess-twitter.py | |
python preprocess-twitter.py "Some random text with #hashtags, @mentions and http://t.co/kdjfkdjf (links). :)" | |
Script for preprocessing tweets by Romain Paulus | |
with small modifications by Jeffrey Pennington | |
with translation to Python by Motoki Wu | |
Translation of Ruby script to create features for GloVe vectors for Twitter data. |
library(ggplot2) | |
library(shiny) | |
# Call ggbrush with a ggplot2 object, and the dimensions which | |
# should be brushed (try "xy" for scatter, "x" for histogram). | |
# The plot will show in RStudio Viewer or your web browser, and | |
# any observations selected by the user will be returned. | |
ggbrush <- function(plotExpr, direction = c("xy", "x", "y")) { | |
# See below for definition of dialogPage function |
# Check URLs in a document | |
## This code will extract URLs from a text document using regex, | |
## then execute an HTTP HEAD request on each and report whether | |
## the request failed, whether a redirect occurred, etc. It might | |
## be useful for cleaning up linkrot. | |
if (!require("httr")) { | |
install.packages("httr", repos = "http://cran.rstudio.com/") | |
} |
# Simulation script for factor analysis ala Leung & Drton (2016) ---------- | |
library(rstan) | |
library(bayesplot) | |
m <- 5 # dimension of observed data (e.g., # traits) | |
k <- 2 # number of latent factors | |
n <- 100 # number of sample units (e.g., # species) | |
# residual variance matrix (is diagonal) | |
Omega <- diag(.3 + abs(rnorm(m, sd = .3))) |
group.mean <- function(x, group) { | |
out <- tapply(x, group, mean, na.rm = TRUE) | |
out[group] | |
} | |
data(state.fips, package = "maps") | |
state.fips <- unique(state.fips[,c("fips","abb")]) | |
state.fips$abb <- as.character(state.fips$abb) | |
state.fips <- rbind(state.fips, c(2, "AK")) | |
state.fips <- rbind(state.fips, c(15, "HI")) |
# metadata | |
data_source <- "https://docs.google.com/spreadsheets/d/1xa0iLqYKz8x9Yc_rfhtmSOJQ2EGgeUVjvV4A8LsIaxY/htmlview?sle=true#gid=0" | |
data_collectors <- "Jeremy Pressman (@djpressman, U of Connecticut) and\nErica Chenoweth (@EricaChenoweth, U of Denver)" | |
code_gist <- "https://gist.github.com/benmarwick/a1ac9c7235ebef542824512162ff2f44" | |
# ------------------------------------------------------------------------ | |
# read in data from google sheets to get a data frame |