sss4clj

Introduction to sss4clj

Shotgun Stochastic Search is an algorithm for maximizing functions {0,1}ᴾ → ℝ described in Shotgun Stochastic Search for “Large p” Regression. The philosophy of sss4clj is "less is more". Rather than provide a monolithic library that supplies a unique function for all possible optimization problems, sss4clj provides a minimal set of very general composable functions, which the user can combine to apply to any specific case. Essentially to use this package the user must only supply a function that maps a set to a double. Each element a ∈ {0,1}ᴾ can be uniquely identified by an "active set" i.e. {i ∈ ℕ| aᵢ = 1}. This project makes the design choice to work with the latter. sss4clj runs on the JVM so is consequently fast and completely interoperable with other JVM hosted languages commonly used in production (Java, Scala, Groovy etc...). This code has also been used successfully as a service for R, communicating with the R process via sockets. Details on how to achieve that can be obtained here. There is also a github page for this project, please file any issues or pull requests thereunder.

Why Clojure?

Clojure is a modern dialect of Lisp, hosted on the JVM, with full support for functional programming. Functional programs, avoiding mutability of named values, are much easier to reason about compared to their iterative counterparts by virtue of referential transparency and the substitution model of evaluation. Functional programming is an alternative to object oriented programming as a solution to the expression problem, in particular, functional languages allow the programmer to reach a higher level of abstraction, resulting more generic code and more code reuse. However, whilst Clojure is a predominantly functional language with persistant datastructures by default, it does allow the user to break purity (unlike Haskell) if performance is an issue. Clojure is, however, already a fast programming language as comparisons with C++ on the languages benchmark show. Being hosted on the JVM is also a great advantage, a widely tested and industry adopted platform, allowing total interoperability with Java and the libraries that come with it. As a result, industry programmers can incorporate sss4clj into their production code with ease. On the other hand, Clojure is dynamically typed and has a REPL, making it a very familiar workflow to individual users of languages such as R or Julia. Another functional language on the JVM is Scala which is also very popular, so why not Scala? Two of the most notable differences are that Scala is still very much influenced by object oriented programming whereas Clojure eschews this approach and Scala is statically typed whereas Clojure is dynamically typed. This is down to preference. If you find that creating classes for everything makes your code overly complex, you may prefer clojure. Statically typed languages may catch errors sooner than those dynamically typed (at compile time rather that run time), but requires type annotations everywhere, increasing the amount of ceremony required to interact with the language. Both have their advantages.

Installation with Leiningen

Add the following dependency in your project.clj file

Clojars Project

Acknowledgements

Shotgun Stochastic Search is an algorithm developed by Chris Hans, Adrian Dobra and Mike West.

This material was based upon work partially supported by the National Science Foundation under Grant DMS-1127914 to the Statistical and Applied Mathematical Sciences Institute. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

License

Copyright © 2017 Michael Lindon

Distributed under the Eclipse Public License either version 1.0