Book Image

Clojure for Machine Learning

By : Akhil Wali
Book Image

Clojure for Machine Learning

By: Akhil Wali

Overview of this book

<p>Clojure for Machine Learning is an introduction to machine learning techniques and algorithms. This book demonstrates how you can apply these techniques to real-world problems using the Clojure programming language.</p> <p>It explores many machine learning techniques and also describes how to use Clojure to build machine learning systems. This book starts off by introducing the simple machine learning problems of regression and classification. It also describes how you can implement these machine learning techniques in Clojure. The book also demonstrates several Clojure libraries, which can be useful in solving machine learning problems.</p> <p>Clojure for Machine Learning familiarizes you with several pragmatic machine learning techniques. By the end of this book, you will be fully aware of the Clojure libraries that can be used to solve a given machine learning problem.</p>
Table of Contents (17 chapters)
Clojure for Machine Learning
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Querying and storing datasets


When dealing with large datasets, it's useful to be able to query the data based on some arbitrary conditions. Also, it's more reliable to store the data in a database rather than in a flat file or as an in-memory resource. The Incanter library provides us with several useful functions to perform these operations, as we will demonstrate in the code example that will follow.

Note

The Incanter library and the MongoDB driver used in the upcoming example can be added to a Leiningen project by adding the following dependency to the project.clj file:

[congomongo "0.4.1"]
[incanter "1.5.4"]

For the upcoming example, the namespace declaration should look similar to the following declaration:

(ns my-namespace
  (:use incanter.core
        [incanter.mongodb   :only [insert-dataset
                                   fetch-dataset]]
        [somnium.congomongo :only [mongo!]]
        [incanter.datasets  :only [get-dataset]]))

Also, this example requires MongoDB to be installed...