> inspired by the bher compiler for the probabilistic scheme dialect MIT
> Church, I have implemented a version of the probability monad which
> uses Metropolis Hastings to draw samples from runs of monadic
> programs. You can find the code on github: https://github.com/bertschi/ProbClojureNice.
There's also this one in clojure-contrib (old, not yet moved to the new contrib collection):
Konrad.
> The two approaches are somewhat complementary to each other. Your
> monad does exact inference on discrete distributions by running
> through all possibilities. Mine is sampling based and does approximate
> inference using MCMC.
I tried that approach as well:
but I never used it much because for my own applications, exact inference
was very doable. I'll check out yours for comparison!
Konrad.
> downstream conditioning somewhat different. The stream can basically
> be filtered to implement rejection sampling, whereas I thread a
> database state through the program to record all random choices (as
> well as their probability) that have been taken.
Right, your approach is very different. There are many ways to skin this
cat...
Konrad.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
good idea to move this over to clojure 1.3. I have just included your
patch.
On Nov 20, 5:32 am, Jeff Rose <ros...@gmail.com> wrote:
> Cool! I experimented a little bit with Church a while back, but
> having something like this in Clojure could be really interesting. I
> don't have much experience with sampling, but if I understand it
> correctly, your grass-is-wet demo is defining a belief network where
> each sample taken represents the complete state of the graph, or just
> the final outcome? What does a sample look like? It would be great
> if we could use this kind of generative model to create chord
> sequences, melodies, and rhythms for Overtone. I don't know what
> kinds of choice points would be appropriate, or if we could train them
> based on a database of existing progressions?
The grass-is-wet demo indeed specifies a belief network. In contrast
to Church, the definition of the model, conditioning on observations
and specifying the output variables is all done in one path. This
works exactly like the probability monad in clojure.contrib. Thus,
each sample corresponds to an outcome of the output variables, i.e.
"rain" in the example. Since the model is conditioned on "grass-is-wet
= true", using m-zero of the monad implements rejection sampling, you
obtain samples of the posterior distribution p(rain | grass-is-wet =
true).
In principle it should be possible to use it for generative models of
music. Since I'm not an expert in this area, I don't know which kind
of models and probability distributions are useful to describe musical
structure. Let me know if you have an idea, I would be happy to help
putting it into clojure.
Best,
Nils
good catch, I don't know how I missed that???
Just uploaded a fix ... should work now.
Nils
On Nov 20, 5:58 pm, Julius Seporaitis <jul...@seporaitis.net> wrote:
> Hello guys,
>
> I would like to try out this library, but ran into a problem with Clojure
> 1.3, 'lein repl' throws an exception, when:
>
> *user=> (use 'probabilistic-clojure.monadic.demos)*
> *user=> (test-mixture mixture-mem) *
> *Trying to find valid trace ...*
> *Starting MH-sampling.*
> *IllegalArgumentException No value supplied for key: 0.7
> clojure.lang.PersistentHashMap.createWithCheck (PersistentHashMap.java:89)*