Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ariddell on github.
  • I am abr (https://keybase.io/abr) on keybase.
  • I have a public key whose fingerprint is E6EC B622 FE41 924C DC46 989D 752C 5943 F6D4 3CFF

To claim this, I am signing this object:

@ariddell
ariddell / authorities.cfg
Created February 3, 2015 15:18
dename client config
[consensus]
SignaturesRequired = 2
[freshness]
SignaturesRequired = 2
[verifier "mit"]
PublicKey = CiCheFqDmJ0Pg+j+lypkmmiHrFmRn50rlDi5X0l4+lJRFA==
[verifier "alokat"]
PublicKey = CiD6CFKBpG54dG3OMx6PJ58z5rlNFK24Dx2HMpR7urHIVA==
[verifier "isk"]
from time import time
import logging
import numpy as np
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
from gensim.matutils import Sparse2Corpus
#from gensim.models.ldamodel import LdaModel
from gensim.models.ldamulticore import LdaMulticore
'''
Gibbs sampler for function:
f(x,y) = x x^2 \exp(-xy^2 - y^2 + 2y - 4x)
using conditional distributions:
x|y \sim Gamma(3, y^2 +4)
y|x \sim Normal(\frac{1}{1+x}, \frac{1}{2(1+x)})
'''
@ariddell
ariddell / novels.r
Created February 13, 2012 15:34
random sample of English novels, 1800-1836 (Garside et al. bibliography)
library(ggplot2)
library(arm)
###############################################################################
## load data
###############################################################################
data_raw = "status year author further_editions
private/for-profit scan 1822 Isabel HILL 0
public scan 1827 Sarah Wilmot WELLS 0
# Identifying character names in The Adventures of David Simple
# source: http://www.munseys.com/diskone/davidsimp.htm
#
# commands:
# ./ner.sh david_simple.txt > david_simple.ner.txt
# sed -e 's/\S\+\/[^P]\w*//g' -e 's/\s\{2,\}/\n/g' -e 's/\/PERSON//g' david_simple.ner.txt | sort | uniq -c | sort -nr | sed 's/^\s\+//' | awk '{if ($1 > 1) print $1,"\t",substr($0, length($1)+2) }'
# note: ner.sh is Stanford NER http://nlp.stanford.edu/software/CRF-NER.html
238 David
131 Cynthia
@ariddell
ariddell / silverfork_novels_scans.csv
Created May 21, 2010 16:13
Silver fork novels bibliography and associated scans
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 7.
"creator","lastname","title","year","notes_general","internet_archive_identifier","google_books_id","mssing_or_incomplete"
"MARGUERITE, COUNTESS OF BLESSINGTON","MARGUERITE","The Repealers",1833,,"gracecassidyorre03bles gracecassidyorre01bles gracecassidyorre02bles",,
"MARGUERITE, COUNTESS OF BLESSINGTON","MARGUERITE","The Two Friends",1835,,"twofriendsnovel02bles twofriendsnovel03bles twofriendsnovel01bles",,
"MARGUERITE, COUNTESS OF BLESSINGTON","MARGUERITE","The Confessions of an Elderly Gentleman",1836,,"ladyconfess01blesrich ladyconfess02blesrich confessionsofeld00blesuoft",,
"MARGUERITE, COUNTESS OF BLESSINGTON","MARGUERITE","The Victims of Society",1837,,"victimsofsociety01bles victimsofsociety02bles victimsofsociety03bles","Ha4lAAAAMAAJ 31EEAAAAQAAJ",
"MARGUERITE, COUNTESS OF BLESSINGTON","MARGUERITE","The Confessions of an Elderly Lady",1838,,"confessionsofeld00blesiala confessionsofane00blesuoft ladyconfess01blesrich ladyconfess02blesrich",,
"MARGUERITE, COUNTESS OF BLESSINGTON","MARGUERITE","The Go
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2. in line 1.
genre name start year end year duration source source pub year
Courtship Novel 1740 1820 81 Green, The Courtship Novel 1740-1820 1991
Picaresque 1748 1790 43 Chandler, The Literature of Roguery 1907
Oriental Tale 1759 1787 29 Baker, The History of the English Novel 1924
Epistolary Novel 1766 1795 30 Raven in The English Novel, vol. I 2000
Sentimental Novel 1768 1790 23 Mullan in The Cambridge Companion to the Eighteenth-Century Novel 1996
Spy' Novel 1770 1800 31 Flint in PMLA 113 (2) 1998
Ramble Novel 1773 1790 18 Dickie, The Mid-Century 'Ramble' Novels 2000
Jacobin Novel 1789 1805 17 Kelly, The English Jacobin Novel 1780-1805 1967
Gothic Novel 1790 1820 31 Garside in The English Novel, vol. II 2000