Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feat/sparse #209

Merged
merged 4 commits into from
Jun 27, 2024
Merged

Feat/sparse #209

merged 4 commits into from
Jun 27, 2024

Conversation

magbb
Copy link
Collaborator

@magbb magbb commented Jun 26, 2024

Implements sparse matrices for counts:

import dhlab as dh
corpus = dh.Corpus(doctype="digibok", limit=1000)

# with sparse matrix
cnt=corpus.count(sparse=True)

# without sparse matrix (this will probably not work on a 16 GB RAM laptop)
cnt=corpus.count()

Combined with cutoff, this could be a powerful option, especially for larger corpora.

@magbb magbb requested review from Yoonsen and Ingerid June 26, 2024 14:27
@Yoonsen
Copy link
Collaborator

Yoonsen commented Jun 26, 2024

Det her er jo framifrå!
Eksisterende kode vil fungere normalt?

@magbb
Copy link
Collaborator Author

magbb commented Jun 26, 2024

Det her er jo framifrå! Eksisterende kode vil fungere normalt?

Jepp, det skal den gjøre. Defaulten er false. Merger i morgen.

@magbb
Copy link
Collaborator Author

magbb commented Jun 26, 2024

La til funksjonalitet for summering over glisne matriser. Uten dette ser det ut til at Pandas gjøre matrisene tette og fyller minnet.

import dhlab as dh
corpus = dh.Corpus(doctype="digibok", limit=1000)

# with sparse matrix
cnt=corpus.count(sparse=True)
cnt.sum()

Copy link
Collaborator

@Ingerid Ingerid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ser bra ut!

@magbb magbb merged commit 0c9b97a into main Jun 27, 2024
1 check passed
@magbb magbb deleted the feat/sparse branch June 27, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants