September 2015
Beginner to intermediate
608 pages
13h 43m
English
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) ...
Read now
Unlock full access