Database Reference
In-Depth Information
4.
We use count-hits to get the number of times that baker appears in each
window of tokens:
(def baker-hits
(map (partial count-hits "baker") windows))
5.
At this point, we have the frequency of baker across the document. However, this
doesn't really show trends. To get the rolling average, we'll deine a function that
maps a function to a rolling window of n items from a collection:
(defn rolling-fn [f n coll]
(map f (partition n 1 coll)))
6.
We'll apply the mean function to the sequence of frequencies for the term baker to
get the rolling average for sets of 10 windows:
(def baker-avgs (rolling-fn s/mean 10 baker-hits))
This graph shows the smoothed data overlaid over the raw frequencies:
 
Search WWH ::




Custom Search