Awesome
A quick try at topic models (see discussion).
Run 0.build.r
from the sociothese
folder to replicate the model and plots. The script sets a few model parameters and estimates LDA models:
- first on summaries that match the
relig*
keyword: N = 220 (runs in one hour) - and then on the full sample: N = 3,219 (much slower, needs a dozen hours at least).
The functions come from Grün and Hornik 2011 or from this example (in Japanese).
Here's what the topic models for the full sample look like in network form, trimmed down to the most common terms that appear in the summaries:
Instead of working with a network
object, you can also turn the result of the topic.graph
function into a d3.js object with Christopher Gandrud's d3Network
function:
library(devtools)
install_github("christophergandrud/d3Network")
library(d3Network)
d3SimpleNetwork(as.data.frame(g), file = "d3Network.html",
fontsize = 14, width = 800, height = 800, opacity = 1)
The result will be a clickable object on which you can underline the nodes with highest degree (the connecting terms that appear in many summaries):
If the sociothese
repo is made public, this link should display the d3 network.