knitr::opts_chunk$set(echo = TRUE)
library(jDirichletMixtureModels) dmm.setup()
An exmaple of creating a BaseModel object to use a bulit-in conjugate model and getting the cluster information:
X=rnorm(100) m=dmm.BaseModel("UnivariateNormalModel", c(0.,1.,1.,1.)) o=dmm.cluster(m,X) state=o[[1]] dmm.summarize(state$clusters) Xdata=rbind(matrix(rnorm(100),ncol=2),1+matrix(rnorm(100),ncol=2)/2) m=dmm.BaseModel("MultivariateNormalModel", data=Xdata) o=dmm.cluster(m,Xdata,iters=1000) state=o[[1]] dmm.summarize(state$clusters)
An example of creating a JModel object: a model defined using user given Julia functions.
X=rnorm(100) dmm.addfile("example2.jl") m1=dmm.JConjugateModel("example_pdf", "example_post", "example_marg", list(0.0,1.0,2.0,0.5)) o=dmm.cluster(m1,X,iters=500) dmm.summarize(o[[1]]$clusters) m2=dmm.JNonConjugateModel("example_pdf", "example_pri", list(0.0,1.0,2.0,0.5)) o=dmm.cluster(m2,X,iters=500) dmm.summarize(o[[1]]$clusters)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.