Parallelizing processing with Incanter
In the upcoming chapters, many recipes will feature Incanter. One of its good features is that it uses the Parallel Colt Java library (http://sourceforge.net/projects/parallelcolt/) to actually handle its processing. So when you use a lot of matrix, statistical, or other functions, they're automatically executed on multiple threads.
For this, we'll revisit the Virginia housing-unit census data from the Managing program complexity with STM recipe in Chapter 3, Managing Complexity with Concurrent Programming. This time, we'll fit it to a linear regression.
Getting ready
We need to add Incanter to our list of dependencies in our Leiningen project.clj
file:
(defproject parallel-data "0.1.0" :dependencies [[org.clojure/clojure "1.6.0"] [incanter "1.5.5"]])
We also need to pull these libraries into our REPL or script:
(use '(incanter core datasets io optimize charts stats))
We'll use the...