From 7b1035364546b2887bd1779b3711daaca4cc9d3c Mon Sep 17 00:00:00 2001 From: Jan-Willem van de Meent Date: Sun, 24 Jul 2016 10:08:39 -0700 Subject: [PATCH 1/8] set version to 1.0.0 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index f2ad6f34..3c4ff691 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject anglican "1.0.0-SNAPSHOT" +(defproject anglican "1.0.0" :description "Anglican, a probabilistic programming system" :url "http://bitbucket.org/probprog/anglican" :license {:name "GNU General Public License Version 3" From 1ed97621b10e307bbad4837a8a7a428d08d5e159 Mon Sep 17 00:00:00 2001 From: david tolpin Date: Tue, 6 Dec 2016 23:34:27 +0000 Subject: [PATCH 2/8] README.md edited online with Bitbucket --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9829d4d0..b21801d5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Anglican is a probabilistic programming system implemented in Clojure, both the programming environment and -the language. [Introduction to anglican](doc/intro.md) explains +the language. [Introduction to Anglican](doc/intro.md) explains how to write and run programs in anglican. Everyone is welcome to write programs which call inference, @@ -32,4 +32,4 @@ GNU General Public License for more details. You should have received a copy of the [GNU General Public License](gpl-3.0.txt) along with Anglican. If not, see -. +. \ No newline at end of file From cb05865cc539c78c5d224fdba05930ab20c066bf Mon Sep 17 00:00:00 2001 From: LSaldyt Date: Mon, 25 Jun 2018 20:04:48 -0700 Subject: [PATCH 3/8] Adds install instructions one liner. This seems important for newer clojure users? --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b21801d5..d5450ac0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,9 @@ Anglican is a probabilistic programming system implemented in Clojure, both the programming environment and -the language. [Introduction to Anglican](doc/intro.md) explains +the language. +To include Anglican in your Clojure project, add `[anglican "1.0.0"]` to your `project.clj` `:dependencies`. +[Introduction to Anglican](doc/intro.md) explains how to write and run programs in anglican. Everyone is welcome to write programs which call inference, @@ -32,4 +34,4 @@ GNU General Public License for more details. You should have received a copy of the [GNU General Public License](gpl-3.0.txt) along with Anglican. If not, see -. \ No newline at end of file +. From 47ba410eb6c39313c559692b194dd274069eebf7 Mon Sep 17 00:00:00 2001 From: LSaldyt Date: Tue, 26 Jun 2018 15:46:04 -0700 Subject: [PATCH 4/8] Adds a uniform-draw function --- project.clj | 6 +++--- src/anglican/runtime.clj | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/project.clj b/project.clj index 3c4ff691..8c42034e 100644 --- a/project.clj +++ b/project.clj @@ -1,6 +1,6 @@ -(defproject anglican "1.0.0" +(defproject org.clojars.lsaldyt/anglican "1.0.0" :description "Anglican, a probabilistic programming system" - :url "http://bitbucket.org/probprog/anglican" + :url "https://github.com/LSaldyt/anglican" :license {:name "GNU General Public License Version 3" :url "http://www.gnu.org/licenses/gpl.html"} :dependencies [[org.clojure/clojure "1.8.0"] @@ -14,7 +14,7 @@ [net.mikera/vectorz-clj "0.44.0"]] :plugins [[codox "0.8.11"]] :scm {:name "git" - :url "https://bitbucket.org/probprog/anglican"} + :url "https://github.com/LSaldyt/anglican"} :repl-options {:timeout 600000} :main ^:skip-aot anglican.core :target-path "target/%s" diff --git a/src/anglican/runtime.clj b/src/anglican/runtime.clj index b33565c0..9ba2d032 100644 --- a/src/anglican/runtime.clj +++ b/src/anglican/runtime.clj @@ -56,7 +56,7 @@ (sample* [this] "draws a sample from the distribution") (observe* [this value] - "return the probability [density] of the value")) + "return the log (using Math/log) probability [density] of the value")) ;; Log probabilities are used pervasively. A precision-preserving ;; way to add probabilities (e.g. for computing union probability) @@ -175,7 +175,8 @@ (loop [[weight & weights] weights acc 0. value 0] (let [acc (+ acc weight)] - (if (< x acc) value + (if (< x acc) + value (recur weights acc (inc value))))))) (observe* [this value] (Math/log @@ -184,6 +185,18 @@ ;; any value not in the support has zero probability. (catch IndexOutOfBoundsException _ 0.))))) +(declare uniform-discrete) +(defdist uniform-draw + "Uniformly take a value from a vector" + [items] [n-items (count items) + dist (uniform-discrete 0 n-items)] + (sample* [this] + (let [i (sample* dist)] + (get items i))) + (observe* [this value] + (Math/log (/ 1 n-items)))) + + (declare gamma) (defdist dirichlet "Dirichlet distribution" @@ -237,6 +250,9 @@ (from-apache uniform-discrete [min max] :discrete (UniformInteger (int min) (dec (int max)))) +;(defn ) +;(uniform-discrete 0 10) + (defprotocol multivariate-distribution "additional methods for multivariate distributions" (transform-sample [this samples] From 234d41379e3e6aa7d01cb161a7597aaee727eecd Mon Sep 17 00:00:00 2001 From: LSaldyt Date: Tue, 26 Jun 2018 16:20:39 -0700 Subject: [PATCH 5/8] Adds alt-clojars path --- README.md | 1 + project.clj | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d5450ac0..97c55c42 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Anglican is a probabilistic programming system implemented in Clojure, both the programming environment and the language. To include Anglican in your Clojure project, add `[anglican "1.0.0"]` to your `project.clj` `:dependencies`. +*This* version of anglican (the LSaldyt fork) can be used with `[org.clojars.lsaldyt/anglican "1.0.1"]`. [Introduction to Anglican](doc/intro.md) explains how to write and run programs in anglican. diff --git a/project.clj b/project.clj index 8c42034e..51c92b9d 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject org.clojars.lsaldyt/anglican "1.0.0" +(defproject org.clojars.lsaldyt/anglican "1.0.1" :description "Anglican, a probabilistic programming system" :url "https://github.com/LSaldyt/anglican" :license {:name "GNU General Public License Version 3" From f4dcae4413e5e611f4e11ebc76c38248108c3d9a Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Wed, 27 Jun 2018 07:22:40 -0600 Subject: [PATCH 6/8] Adds minimalistic .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..07913052 --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +language: clojure From b20de6a7aed09c9bc1be87e1fbc43010475cad97 Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Wed, 27 Jun 2018 07:24:24 -0600 Subject: [PATCH 7/8] Change to trigger travis CI --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 97c55c42..ca2e26af 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,7 @@ GNU General Public License for more details. You should have received a copy of the [GNU General Public License](gpl-3.0.txt) along with Anglican. If not, see . + +## Continuous Integration + +Adds TravisCI From 733b4023efb5df15ee7d2adecd926debef20453d Mon Sep 17 00:00:00 2001 From: Lucas Saldyt Date: Wed, 27 Jun 2018 08:13:13 -0600 Subject: [PATCH 8/8] Adds travis badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ca2e26af..4e798de7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Anglican +[![Build Status](https://travis-ci.org/LSaldyt/anglican.svg?branch=master)](https://travis-ci.org/LSaldyt/anglican) + Anglican is a probabilistic programming system implemented in Clojure, both the programming environment and the language.