Last active
August 8, 2017 08:36
-
-
Save talesa/626423f5b74d2b507aff841fc8f3f1c6 to your computer and use it in GitHub Desktop.
Using assoc in foppl example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [[G E] | |
(foppl-query | |
(defn loopi [i mu] (assoc mu (+ i 1) (sample (normal (get mu i) 1)))) | |
(loop 4 (vector 1 1 1 1 1) loopi))] | |
(print-graph G) | |
(:body E)) | |
;;; Vertices V: #{x38089 x38096 x38075 x38082} | |
;;; | |
;;; Arcs A: #{} | |
;;; | |
;;; Conditional densities P: | |
;;; x38075 -> (fn [] (normal 1 1)) | |
;;; x38082 -> (fn [] (normal nil 1)) | |
;;; x38089 -> (fn [] (normal nil 1)) | |
;;; x38096 -> (fn [] (normal nil 1)) | |
;;; | |
;;; Observed values O: | |
;;; | |
;; <- | |
;;; (assoc (assoc (assoc (assoc [1 1 1 1 1] 1 x38075) 2 x38082) 3 x38089) 4 x38096) | |
(let [[G E] | |
(foppl-query | |
(defn loopi [i mu] (assoc mu (+ i 1) (* 2 (get mu i)))) | |
(loop 4 (vector 1 1 1 1 1) loopi))] | |
(print-graph G) | |
(:body E)) | |
;;; Vertices V: #{} | |
;;; | |
;;; Arcs A: #{} | |
;;; | |
;;; Conditional densities P: | |
;;; | |
;;; | |
;;; Observed values O: | |
;;; | |
;;; | |
;; <- | |
;;; [1 2 4 8 16] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment