# NOT RUN {
data(qsar_binary)
jacc_sim <- apd_similarity(binary_tr)
jacc_sim
# plot the empirical cumulative distribution function (ECDF) for the training set:
library(ggplot2)
autoplot(jacc_sim)
# Example calculations for two samples:
A <- as.matrix(binary_tr[1,])
B <- as.matrix(binary_tr[2,])
xtab <- table(A, B)
xtab
# Jaccard statistic
xtab[2, 2] / (xtab[1, 2] + xtab[2, 1] + xtab[2, 2])
# Hamman statistic
( ( xtab[1, 1] + xtab[2, 2] ) - ( xtab[1, 2] + xtab[2, 1] ) ) / sum(xtab)
# Faith statistic
( xtab[1, 1] + xtab[2, 2]/2 ) / sum(xtab)
# Summarize across all training set similarities
mean_sim <- score(jacc_sim, new_data = binary_unk)
mean_sim
# }
Run the code above in your browser using DataLab