Skip to content

Instantly share code, notes, and snippets.

View philohistoria's full-sized avatar

Han Zhang philohistoria

View GitHub Profile
@philohistoria
philohistoria / stm_topic_test.r
Created September 10, 2017 05:17
Simplest workflow for STM R package
library(stm)
data <- read.csv("pol.csv")
processedtest <- textProcessor(data$documents, metadata = data)
outtest <- prepDocuments(processedtest$documents, processedtest$vocab, processedtest$meta)
poliblogPrevFit <- stm(documents = out$documents, vocab = out$vocab, K = 20, prevalence =~ rating + s(day), max.em.its = 10, data = out$meta, init.type = "Spectral")
prep <- estimateEffect(1:20 ~ rating + s(day), poliblogPrevFit, meta = out$meta, uncertainty = "Global")
@philohistoria
philohistoria / opendriver.py
Last active December 12, 2017 20:26
Open Drivers
# -*- coding: utf-8 -*-
from selenium import webdriver
import os
driver = '/Users/han/Dropbox/Codes/webdriver/chromedriver'
os.environ["webdriver.chrome.driver"] = driver
driver = webdriver.Chrome(driver)
]q(X external_idqXcommandqXtsqe.M.}q(K}q(X __version__qKXcommandqXf = open("/Users/han/Documents/workspace/WeiboDeleted/log_oldtreat.txt",encoding="utf-8")
w = open("/Users/han/Documents/workspace/WeiboDeleted/log_old_useful.txt",encoding="utf-8")qX__id__qKX external_idqXpythonqXtsqcdatetime
datetime
q C
 zq
q Rq uK}q (hKhXl = [1047669615,1048296970,1067326000,1071750167,1081021387,1188868702,1197011891,1216026271,1226162531,1236709234,1269475093,1290153010,1299970031,1369633971,1395365674,1400272691,1411824754,1415859710,1449204363,1455131001,1460570074,1462311881,1565687157,1642991815,1647345487,1649196637,1650008680,1653744734,1654010852,1655668652,1680683820,1686443664,1687540800,1697227057,1705396685,1727747065,1733119815,1734612364,1735778800,1737943787,1741617712,1742483557,1742733704,1747171950,1749244184,1760344377,1766476347,1772689980,1780766333,1791072365,1792251887,1793087587,1799934707,1800392783,1827724077,1828351354,183167595