Open
Conversation
suport MultiIndex as function parameter returns MultiIndex, where Representation was returned * missing: correct test Co-authored-by: Henri Froese <hf2000510@gmail.com>
*missing: test adopting for new types Co-authored-by: Henri Froese <hf2000510@gmail.com>
Co-authored-by: Henri Froese <henri.froese@yahoo.com>
Missing: Tests & Docstring Co-authored-by: Maximilian Krahn <maximilian.krahn@icloud.com>
17 tasks
Black just rolled out V20.8b1. This creates errors with our ./tests.sh -> switch back
…ate/texthero into filter_extremes
Collaborator
Author
|
Note: Black (our formatter) just rolled out V20.8b1 3 days ago. This creates errors with our ./tests.sh in preprocessing because of whitespace. Will investigate this further but atm we set the black version in EDIT: found the issue, see the issue opened at Black here |
Owner
|
Thanks. Will review once the previous PRs are merged |
Owner
|
Waiting for #162 to be merged + will need to conflicts change (and will simplify the code). |
Collaborator
|
we have now implemented all changes from the master and this branch is also ready to review/to be merged 🐙 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We add a new function
hero.filter_extremes(s: TokenSeries, max_words=None, min_df=1, max_df=1.0)to remove words from all documents that are above or below a document frequency threshold; additionally only keep max_words many words. Naming from gensim's similar function here.Excerpt from docstring to explain functionality:
Decrease the size of your documents by
filtering out words by their frequency.
It is often useful to reduce the size of your dataset
by dropping words in order to
reduce noise and improve performance.
This function removes all words/tokens from
all documents where the
document frequency (=number of documents a term appears in) is
When min_df or max_df is an integer, then document frequency
is the absolute number of documents that a term
appears in. When it's a float, it is the
proportion of documents a term appears in.
Additionally, only max_words many words are kept.
Parameters
max_words : int, default to None
The maximum number of words/tokens that
are kept, according to term frequency descending.
If None, will consider all features.
min_df : int or float, default to 1
Remove words that have a document frequency
lower than min_df. If float, it represents a
proportion of documents, integer absolute counts.
max_df : int or float, default to 1
Remove words that have a document frequency
higher than max_df. If float, it represents a
proportion of documents, integer absolute counts.
Example
Note: only so many lines changed as this builds upon the DocumentTermDF (see #156)