labeled inverse cell frequency: IGM

idf_igm(expr, features = NULL, label, lambda = 7, thres = 0)

Arguments

expr

a matrix, features in row and cells in column

features

vector, feature names or indexes to compute

label

vector, group label of each cell

lambda

numeric, hyperparameter for IGM

thres

numeric, cell only counts when expr > threshold, default 0

Value

a vector of inverse gravity moment score for each feature

Details

$$\mathbf{IGM_i} = log(1+\lambda\frac{max(n_{i,j\in D})_{k}}{\sum_{k}^{K}((n_{i,j\in D})_{k}*r_{k})+e^{-8}})$$ where \(\lambda\) is the hyper parameter, \(n_{i,j\in D}\) is the number of cells containing feature \(i\) in class \(D\), \(r_k\) is the rank of \(n_{i,j\in D}\).

Examples

data <- matrix(rpois(100, 2), 10, dimnames = list(1:10))
smartid:::idf_igm(data, label = sample(c("A", "B"), 10, replace = TRUE))
#>        1        2        3        4        5        6        7        8 
#> 1.203973 1.203973 1.335001 1.203973 1.265666 1.203973 1.203973 1.335001 
#>        9       10 
#> 1.203973 1.203973