Description Usage Arguments Details Value References Examples
apd_similarity()
is used to analyze samples in terms of similarity scores
for binary data. All features in the data should be binary (i.e. zero or
one).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  apd_similarity(x, ...)
## Default S3 method:
apd_similarity(x, quantile = NA_real_, ...)
## S3 method for class 'data.frame'
apd_similarity(x, quantile = NA_real_, ...)
## S3 method for class 'matrix'
apd_similarity(x, quantile = NA_real_, ...)
## S3 method for class 'formula'
apd_similarity(formula, data, quantile = NA_real_, ...)
## S3 method for class 'recipe'
apd_similarity(x, data, quantile = NA_real_, ...)

x 
Depending on the context:

... 
Options to pass to 
quantile 
A real number between 0 and 1 or NA for how the similarity
values for each sample versus the training set should be summarized. A value
of 
formula 
A formula specifying the predictor terms on the righthand side. No outcome should be specified. 
data 
When a recipe or formula is used,

The function computes measures of similarity for different samples
points. For example, suppose samples A
and B
both contain p binary
variables. First, a 2x2 table is constructed between A
and B
across
their elements. The table will contain p entires across the four cells
(see the example below). From this, different measures of likeness are
computed.
For a training set of n samples, a new sample is compared to each, resulting in n similarity scores. These can be summarized into a single value; the median similarity is used by default by the scoring function.
For this method, the computational methods are fairly taxing for large data sets. The training set must be stored (albeit in a sparse matrix format) so object sizes may become large.
By default, the computations are run in parallel using all possible
cores. To change this, call the setThreadOptions
function in the
RcppParallel
package.
A apd_similarity
object.
Leach, A. and Gillet V. (2007). An Introduction to Chemoinformatics. Springer, New York
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  ## 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
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.