Skip to content

Commit

Permalink
fix idf calc bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hpliner committed Oct 16, 2019
1 parent e278c65 commit 0c1efdb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: garnett
Type: Package
Title: Automated cell type classification
Version: 0.2.7
Version: 0.2.8
Author: c(
person("Hannah", "Pliner", email = "[email protected]", role = c("aut", "cre")),
person("Cole", "Trapnell", email = "[email protected]", role = c("aut")))
Expand Down
2 changes: 1 addition & 1 deletion R/train_cell_classifier.R
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ tfidf <- function(input_cds) {
ncounts <- ncounts[Matrix::rowSums(ncounts) != 0,]
nfreqs <- ncounts
nfreqs@x <- ncounts@x / rep.int(Matrix::colSums(ncounts), diff(ncounts@p))
tf_idf_counts <- nfreqs * log(1 + ncol(ncounts) / Matrix::rowSums(ncounts))
tf_idf_counts <- nfreqs * log(1 + ncol(ncounts) / Matrix::rowSums(ncounts > 0))
Matrix::t(tf_idf_counts)
}

Expand Down

0 comments on commit 0c1efdb

Please sign in to comment.