bnp

Some older Bayesian nonparametrics research.
Log | Files | Refs | README | LICENSE

commit a671e8b25e262f8b0899c8936079c35cb886de86
parent 92da1ee67b8c6eb0d03bdfaee6f9f4d686f78906
Author: Jared Tobin <jared@jtobin.ca>
Date:   Wed,  9 Mar 2016 11:28:20 +1300

Misc fixes.

Diffstat:
Mfinite-gaussian-mixture/src/fmm_generative.r | 2+-
Mfinite-gaussian-mixture/src/simulation_conditional.r | 17++++++++---------
2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/finite-gaussian-mixture/src/fmm_generative.r b/finite-gaussian-mixture/src/fmm_generative.r @@ -3,7 +3,7 @@ require(magrittr) mixing_model = function(k, a) drop(rdirichlet(1, (rep(a, k)))) label_model = function(n, p) drop(rmultinom(1, size = n, prob = p)) -location_model = function(k, l, r) rnorm(k, l, 1 / r) +location_model = function(k, l, r) rnorm(k, l, sqrt(1 / r)) precision_model = function(k, b, w) rgamma(k, b, 1 / w) parameter_model = function(k, n) { diff --git a/finite-gaussian-mixture/src/simulation_conditional.r b/finite-gaussian-mixture/src/simulation_conditional.r @@ -3,7 +3,7 @@ set.seed(42) require(ggplot2) require(reshape2) -source('fmm_generative.r') +source('fmm_conditional.r') config = list( k = 3 @@ -24,7 +24,7 @@ origin = list( d = melt(model(config$k, config$n)) params = inverse_model( - config$n, config$k, data$value + config$n, config$k, d$value , config$a, config$l, config$r , config$b, config$w ) @@ -33,13 +33,12 @@ dp = melt(as.data.frame(params$p)) dm = melt(as.data.frame(params$m)) ds = melt(as.data.frame(params$s)) -pp = ggplot(dp, aes(x = seq_along(value), y = value, colour = variable)) - + geom_line() +pp = ggplot(dp, aes(x = seq_along(value), y = value, colour = variable)) + + geom_line() -pm = ggplot(dm, aes(x = seq_along(value), y = value, colour = variable)) - + geom_line() - -ps = ggplot(ds, aes(x = seq_along(value), y = value, colour = variable)) - + geom_line() +pm = ggplot(dm, aes(x = seq_along(value), y = value, colour = variable)) + + geom_line() +ps = ggplot(ds, aes(x = seq_along(value), y = value, colour = variable)) + + geom_line()