Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix tfidf using the wrong layer #147

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions muon/_atac/preproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ def tfidf(
tf = np.dot(n_peaks, counts)
else:
n_peaks = np.asarray(counts.sum(axis=1)).reshape(-1, 1)
tf = adata.X / n_peaks
tf = counts / n_peaks

if scale_factor is not None and scale_factor != 0 and scale_factor != 1:
tf = tf * scale_factor
if log_tf:
tf = np.log1p(tf)

idf = np.asarray(adata.shape[0] / adata.X.sum(axis=0)).reshape(-1)
idf = np.asarray(adata.shape[0] / counts.sum(axis=0)).reshape(-1)
if log_idf:
idf = np.log1p(idf)

Expand Down
Loading