I start with the Gaussian weighted averages over the 11 x 11 x 11 x Ch
cubes at each synapse location.
Here I re-factor the data into a two-variable dataset:
INH \(:= \text{Z-score} \circ \sum{\text{Inhibitory Features}}\)
EX \(:= \text{Z-score} \circ \sum{\text{Excitatory Features}}\)
Then plot the new dataset colored by the given gaba
labels. The ellipses superimposed on the plot correspond to the class conditional covariances (at 1,2, and 3 standard deviations) of the components.
Here we are restricting hierarchical GMM to only go through on level. We are comparing the cluster results to the gaba
labels.
set.seed(3144)
h2 <- hmc(sndat[, -1], maxDepth = 2, ccol = ccol, model = c("VVV"))
h2lab <- viridis(max(h2$dat$labels$col))
h2col <- h2$dat$labels$col
p1 <- stackM(h2, ccol = "black", centered = TRUE, depth = 1)
L1 <- h2$dat$labels$L1
p2 <- stackMraw(as.data.frame(sdat), L1, ccol = ccol, depth = 2, centered = TRUE)
grid.arrange(p1, p2, nrow = 1)
cols <- c("black", "magenta")[gabaID$gaba+1]
acols <- alpha(cols, 0.35)
#pairs(h2$dat$data, pch = 19, cex = 0.7, col = acols)
#plot(h2$dat$data, col = acols, pch = c(19,3)[gaba+1], cex = c(0.5,1)[gaba+1])
pairs(sdat, col = acols, pch = c(19,3)[gaba+1], cex = c(0.5,1)[gaba+1])
acols2 <- alpha(h2lab[h2$dat$labels$col], 0.45)
par(bg = "gray45")
#plot(h2$dat$data, pch = c(3,20)[gaba + 1], cex = 1, col = acols2)
pairs(sdat, pch = 19, cex = 0.7, col = acols2)
dev.off()
## quartz
## 2
p0 <- mclust::adjustedRandIndex(pred, gaba)
perms <- foreach(i = 1:1.5e4, .combine = c) %dopar% {
set.seed(i*2)
mclust::adjustedRandIndex(sample(pred), gaba)
}
pv0 <- sum(c(perms,p0) >= p0)/length(perms)
hist(perms, xlim = c(min(perms), p0 + 0.25*p0),
main = "permutation test of ARI values", probability = TRUE)
#hist(perms, probability = TRUE)
abline(v = p0, col = 'red')
t1
## truth
## pred FALSE TRUE
## FALSE 647 15
## TRUE 61 70
measurment | value |
---|---|
Misclassification Rate | 0.0958386 |
Accuracy | 0.9041614 |
Sensitivity | 0.8235294 |
Specificity | 0.9138418 |
Precision | 0.5343511 |
Recall | 0.8235294 |
ARI | 0.5205843 |
\(p\)-value for ARI | 0.000067 |
F1-score | 0.6481481 |
TP | 70 |
FP | 61 |
TN | 647 |
FN | 15 |
False Positives |
---|
195 167 37 |
190 245 28 |
202 194 8 |
203 193 11 |
198 223 10 |
197 193 20 |
195 227 7 |
215 238 17 |
238 217 39 |
308 193 10 |
316 198 35 |
257 236 32 |
308 228 33 |
224 285 22 |
288 271 11 |