O'Reilly logo

Clojure for Data Science by Henry Garner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Collinearity

We might try at this point to keep adding features to our model in an attempt to increase its explanatory power.

For example, we also have a "Date of birth" column and we may be tempted to try and include this too. It is a date, but we could easily convert it into a number suitable for use in regression. We could do this simply by extracting the year from their birth date using the clj-time library:

(defn to-year [str] (-> (coerce/from-date str) (time/year))) (defn ex-3-27 [] (let [data (->> (swimmer-data) (i/add-derived-column "Dummy MF" ["Sex"] dummy-mf) (i/add-derived-column "Year of birth" ["Date of birth"] to-year)) x (->> data (feature-matrix ["Height, cm" "Age" "Dummy MF" "Year of birth"]) (add-bias)) y (->> (i/$ "Weight" data) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required