bnp

Some older Bayesian nonparametrics research.
git clone git://git.jtobin.io/bnp.git
Log | Files | Refs | README | LICENSE

sim_fmm_3d.r (552B)


      1 require(reshape2)
      2 require(scatterplot3d)
      3 
      4 source('fmm_multivariate_generative.r')
      5 
      6 dimension = 3
      7 
      8 config_3d = list(
      9     k = 4
     10   , l = rep(0, dimension)
     11   , r = diag(0.05, dimension)
     12   , b = dimension
     13   , w = diag(1, dimension)
     14   , n = 10000
     15   )
     16 
     17 set.seed(42)
     18 
     19 d_3d = model(
     20     config_3d$k, config_3d$l, config_3d$r
     21   , config_3d$b, config_3d$w, config_3d$n
     22   )
     23 
     24 framed_3d = lapply(d_3d,
     25   function(mat) { data.frame(x = mat[,1], y = mat[,2], z = mat[,3]) })
     26 melted_3d = do.call(rbind, framed_3d)
     27 
     28 scatterplot3d(melted_3d, highlight.3d = T, pch = 19)
     29