This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tm) | |
library(Snowball) | |
gencorpus <- function(dat,stemn=T){ | |
corpus <- Corpus(DataframeSource(data.frame(as.character(dat[,1])))) | |
corpus <- tm_map(corpus, removePunctuation) | |
corpus <- tm_map(corpus, tolower) | |
corpus <- tm_map(corpus, stripWhitespace) | |
corpus <- tm_map(corpus, function(x) removeWords(x,stopwords("english"))) | |
if(stemn==T){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N <- 10 | |
k <- 3 | |
#data | |
x0 <-0 | |
x1 <-10 | |
y0 <-0 | |
y1 <-10 | |
v2 <- 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from BUGS book page 293 | |
#Stick-breaking process | |
#http://www2.imm.dtu.dk/courses/02443/projects/Roeder_JASA_1990.pdf | |
library(rstan) | |
C <- 10 | |
data <-read.csv("data.csv") | |
N <-nrow(data) | |
model <-stan_model("STB.stan") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
#http://d.hatena.ne.jp/teramonagi/20120930/1348982608 | |
#https://gist.github.com/teramonagi/3805923#file-mcmc_replica_exchange_mcmc-py | |
import repMC as repMC |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Sat Jun 14 18:48:17 2014 | |
@author: xiangze | |
""" | |
import numpy as np | |
#from itertools import accumulate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Sat Jun 07 20:38:05 2014 | |
@author: xiangze | |
""" | |
from BeautifulSoup import BeautifulSoup | |
import urllib2 | |
import time |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.