labeled inverse cell frequency: relative frequency
idf_rf(expr, features = NULL, label, multi = TRUE, thres = 0)a matrix of inverse cell frequency score
$$\mathbf{IDF_{i,j}} = log(1+\frac{\frac{n_{i,j\in D}}{n_{j\in D}}}{max(\frac{n_{i,j\in \hat D}}{n_{j\in \hat D}})+ e^{-8}})$$ where \(n_{i,j\in D}\) is the number of cells containing feature \(i\) in class \(D\), \(n_{j\in D}\) is the total number of cells in class \(D\), \(\hat D\) is the class except \(D\).
data <- matrix(rpois(100, 2), 10, dimnames = list(1:10))
smartid:::idf_rf(data, label = sample(c("A", "B"), 10, replace = TRUE))
#> B B B A A B B
#> 1 0.9162907 0.9162907 0.9162907 0.5108256 0.5108256 0.9162907 0.9162907
#> 2 0.5389965 0.5389965 0.5389965 0.8754687 0.8754687 0.5389965 0.5389965
#> 3 0.6931472 0.6931472 0.6931472 0.6931472 0.6931472 0.6931472 0.6931472
#> 4 0.7282385 0.7282385 0.7282385 0.6592456 0.6592456 0.7282385 0.7282385
#> 5 0.6190392 0.6190392 0.6190392 0.7731899 0.7731899 0.6190392 0.6190392
#> 6 0.6190392 0.6190392 0.6190392 0.7731899 0.7731899 0.6190392 0.6190392
#> 7 0.5389965 0.5389965 0.5389965 0.8754687 0.8754687 0.5389965 0.5389965
#> 8 1.2729657 1.2729657 1.2729657 0.3285041 0.3285041 1.2729657 1.2729657
#> 9 0.5389965 0.5389965 0.5389965 0.8754687 0.8754687 0.5389965 0.5389965
#> 10 0.6190392 0.6190392 0.6190392 0.7731899 0.7731899 0.6190392 0.6190392
#> B B A
#> 1 0.9162907 0.9162907 0.5108256
#> 2 0.5389965 0.5389965 0.8754687
#> 3 0.6931472 0.6931472 0.6931472
#> 4 0.7282385 0.7282385 0.6592456
#> 5 0.6190392 0.6190392 0.7731899
#> 6 0.6190392 0.6190392 0.7731899
#> 7 0.5389965 0.5389965 0.8754687
#> 8 1.2729657 1.2729657 0.3285041
#> 9 0.5389965 0.5389965 0.8754687
#> 10 0.6190392 0.6190392 0.7731899