knitr::opts_chunk$set(fig.width=6, fig.height=3)
require(badmf) require(ggplot2) require(MASS) n <- 500 d <- 15 K <- 3
plot_sim <- function(X, Y, name, d1=1, d2=2) { data <- data.frame(x1=X[,d1], x2=X[,d2], class=Y) ggplot(data, aes(x=x1, y=x2, color=class)) + geom_point() + xlab("x1") + ylab("x2") + ggtitle(name) + theme_bw() }
Below, we visualize the different simulation settings with n=400
in d=15
dimensions:
testdat <- badmf.sims.rtrunk(n, d, b=20) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Trunk, 2 Class"))
In this simulation, we show the trunk, estimate a rotation matrix to apply to the mean and covariances, and use a non-equal prior with more class 1 than class 2.
testdat <- badmf.sims.rtrunk(n, d, rotate=TRUE, priors=c(0.8, 0.2), b=20) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Rotated Trunk, 2 Class, non-equal priors"))
testdat <- badmf.sims.rtrunk(n, d, b=20, K=3) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Trunk, 3 Class"))
testdat <- badmf.sims.mean_diff(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Mean Difference 2 Class"))
testdat <- badmf.sims.toep(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Toeplitz"))
testdat <- badmf.sims.qdtoep(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "QD-Toeplitz"))
testdat <- badmf.sims.xor2(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "XOR"))
testdat <- badmf.sims.cigar(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Cigar"))
testdat <- badmf.sims.fat_tails(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Fat Tails"))
sim <- badmf.sims.linear(n, d, K, signal.lshift=3) plot_sim(sim$X, sim$Y, "Linear")
sim <- badmf.sims.radial(n, d=2, K=4) plot_sim(sim$X, sim$Y, "Radial", d1=1, d2=2)
sim <- badmf.sims.cross(n, d) plot_sim(sim$X, sim$Y, "Cross", d1=1, d2=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.