Permalink
Browse files

switched to log-gamma functions of Commons Math library and broadened…

… Dirichlet proposal
  • Loading branch information...
1 parent d73f878 commit f52124ff6f4e2f7528a35352a6c35c05ce5600ac @bertschi committed Jan 19, 2012
Showing with 5 additions and 3 deletions.
  1. +2 −1 project.clj
  2. +3 −2 src/probabilistic_clojure/embedded/choice_points.clj
View
@@ -3,6 +3,7 @@
:url "https://github.com/bertschi/ProbClojureNice"
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/algo.monads "0.1.0"]
- [incanter "1.3.0-SNAPSHOT"]]
+ [incanter "1.3.0-SNAPSHOT"]
+ [org.apache.commons/commons-math "2.2"]]
:dev-dependencies [[swank-clojure "1.3.3"]])
@@ -28,7 +28,8 @@ of probabilistic choice points."}
(:use [probabilistic-clojure.embedded.api :only (def-prob-cp det-cp gv memo)]
[probabilistic-clojure.utils.stuff :only (ensure-list error)]
[incanter.stats :only (sample-normal pdf-normal sample-dirichlet sample-beta pdf-beta)])
- (:import cern.jet.stat.tdouble.Gamma))
+ (:import org.apache.commons.math.special.Gamma))
+ ;; (:import cern.jet.stat.tdouble.Gamma))
(in-ns 'probabilistic-clojure.embedded.choice-points)
@@ -96,7 +97,7 @@ of probabilistic choice points."}
:sampler [] (first (sample-dirichlet 2 alphas))
:calc-log-lik [ps] (log-pdf-dirichlet ps alphas)
:proposer [old-ps] (letfn [(proposal-alphas [alphas]
- (for [a alphas] (* 88 a)))]
+ (for [a alphas] (* 8 a)))]
(let [new-ps (first (sample-dirichlet 2 (proposal-alphas old-ps)))]
[new-ps
(log-pdf-dirichlet new-ps (proposal-alphas old-ps))

0 comments on commit f52124f

Please sign in to comment.