Finally, we can write out our classifier to a file using clj-ml.utils/serialize-to-file
:
(defn ex-4-48 [] (let [dataset (->> (load-data "titanic.tsv") (to-weka) (mlf/make-apply-filter :replace-missing-values {})) classifier (cl/make-classifier :decision-tree :random-forest) file (io/file (io/resource "classifier.bin"))] (clu/serialize-to-file classifier file)))
At some point later, we can load up our trained classifier using the clj-ml.utils/deserialize-from-file
and immediately begin classifying new data.