GithubHelp home page GithubHelp logo

Comments (1)

fwood avatar fwood commented on September 26, 2024

Good catch!

Many apologies both for the delay and for the error.

Please note that this is a simple bug in the implementation of fib. The
correct code can be found here
http://www.robots.ox.ac.uk/~fwood/anglican/examples/viewer/?worksheet=aistats/branching-aistats.
For ease of reference I include it here

(defn fib [n]
"returns the n-th number in the Fibonacci sequence"
(loop [a 1 b 1 m 0](if %28= m n%29
a
%28recur b %28+ a b%29 %28inc m%29%29)))


Dr. Frank Wood
Associate Professor - Information Engineering, Oxford
Fellow - Kellogg College, Oxford
Fellow - Alan Turing Institute
Telephone: +441865283060
Web: http://www.robots.ox.ac.uk/~fwood
Email: [email protected]
Office: IEB 20.03

University of Oxford
Department of Engineering Science
Parks Road
Oxford
OX1 3PJ

Assistant: Maddy Crudge
Email: [email protected]
+44 1865 283058

Where: http://www.eng.ox.ac.uk/contact/how-to-reach-the-department

On Tue, Nov 8, 2016 at 9:03 PM, Kai Xu [email protected] wrote:

The branching model in the branching_aistats.clj file has some
non-deterministic error.

(defn fib [n]
"returns the n-th number in the Fibonacci sequence"
(loop [a 0 b 1 m 0](if %28= m n%29
a
%28recur b %28+ a b%29 %28inc m%29%29)))

(with-primitive-procedures [fib](defquery branching
"A simple example illustrating flow control with
dependence on random choices"
[]
%28let [count-prior %28poisson 4)
r (sample count-prior)
l (if (< 4 r)
6
(+ (fib (* 3 r))
(sample count-prior)))]
(observe (poisson l) 6)
(predict :r r)
(predict :l l))))

If I run it with a lot of particles with SMC sampler, it sometimes give Error
during inference: org.apache.commons.math3.exception.NotStrictlyPositiveException:
mean (0) (but sometimes not). If the # of particles is large (say
500,000), it will be broken nearly every time.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AADZnkNFhQaQ2O7wrv3sBV2o1LZBSkm8ks5q8OOGgaJpZM4Ks54l
.

from anglican-examples.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.