prob.females<-plogis(samples$b_Intercept)

prob.males<-plogis(samples$b_Intercept + samples$b_sexM)

diffprob.female))

]]>library(brms)

options(mc.cores = parallel::detectCores())

a<-rep(0,43)

b<-rep(1,9)

male<-c(a,b)

a<-rep(0,44)

b<-rep(1,4)

female<-c(a,b)

handedness<-c(male,female)

a<-rep("M",52)

b<-rep("F",48)

sex<-c(a,b)

data<-cbind(sex,handedness)

data<-data.frame(data)

str(data)

model<-brm(handedness~sex, data=data, family=bernoulli())

samples<-posterior_samples(model)

prob.females<-plogis(samples$b_Intercept)

prob.males<-plogis(samples$b_Intercept + samples$b_sexM)

diffprob.female))

#0.9175

library(brms)

options(mc.cores = parallel::detectCores())

a<-rep(0,43)

b<-rep(1,9)

male<-c(a,b)

a<-rep(0,44)

b<-rep(1,4)

female<-c(a,b)

handedness<-c(male,female)

a<-rep("M",52)

b<-rep("F",48)

sex<-c(a,b)

data<-cbind(sex,handedness)

data<-data.frame(data)

str(data)

model<-brm(handedness~sex, data=data, family=bernoulli())

samples<-posterior_samples(model)

prob.females<-plogis(samples$b_Intercept)

prob.males<-plogis(samples$b_Intercept + samples$b_sexM)

diffprob.female))

]]>It has all the necessary padding to make the Eigen implementation efficient.

]]>I suggest you actually try to calibrate some real naive Bayes output. What you’ll find is that all the predictions go to 0.999 and 0.001 if you have 100+ word documents and you get really strong overdispersion effects (which logistic regression also can’t correct—you need to transform word vectors to do that or build a proper negative-binomial type model along the lines of the 1964 Bayesian classifier of Mosteller and Wallace!).

You can perform heuristic inference with a Bayesian mean just as well as a maximum likelihood estimate. You’ll find the Bayesian approach a bit more robust, but you can probably get most of the way there without much loss by regularizing heavily.

P.S. My second paper on stats (circa 1998) used exactly this kind of post-calibration on an SVD-reduced representation of word vectors.

]]>