inverse cell frequency using standard deviation (SD)
idf_sd(expr, features = NULL, log = FALSE, thres = 0)
Arguments
- expr
a matrix, features in row and cells in column
- features
vector, feature names or indexes to compute
- log
logical, if to do log-transformation
- thres
numeric, cell only counts when expr > threshold, default 0
Value
a vector of inverse cell frequency score for each feature
Details
$$\mathbf{IDF_i} = log(1+sd(tf_{i})*\frac{n}{n_i+1})$$
where \(tf_i\) is the term frequency of feature \(i\), see details in
tf()
, \(n\) is the total number of cells and \(n_i\) is the number of
cells containing feature \(i\).
Examples
data <- matrix(rpois(100, 2), 10, dimnames = list(1:10))
smartid:::idf_sd(data)
#> 1 2 3 4 5 6 7
#> 0.06191538 0.10035735 0.06957992 0.07781064 0.08512022 0.05712326 0.04502422
#> 8 9 10
#> 0.05292170 0.05366416 0.06581973