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
IGMi=log(1+λmax(ni,j∈D)k∑Kk((ni,j∈D)k∗rk)+e−8)
where λ is the hyper parameter, ni,j∈D is the number
of cells containing feature i in class D, rk is the rank
of ni,j∈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