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

Add flexible group-term-matrix vectorization class #156

Merged
merged 6 commits into from
Jan 16, 2018

Conversation

bdewilde
Copy link
Collaborator

@bdewilde bdewilde commented Jan 15, 2018

Description

  • Add GroupVectorizer class, a child of the existing Vectorizer class, as an extension of typical document-term matrix vectorization, where terms are grouped by the documents in which they co-occur. It allows for customized grouping, such as by a shared author or publication year, that may span multiple documents, without forcing users to merge those documents themselves.
  • Rename a couple attributes of Vectorizer for clarity and consistency with GroupVectorizer: vocabulary => vocabulary_terms and feature_names => terms_list
    • analogously, GroupVectorizer also includes vocabulary_grps and grps_list attrs
  • Improve docstrings, usage examples, and error messages throughout

Motivation and Context

The more flexible vectorization is sort of a niche need, since grouping terms by documents is so generally useful, but you can imagine grouping terms by, say, year or speaker, and comparing these groups by similarity to each other. Another possibility is generating semantic networks where nodes are groups and edges are the similarity of term usage between group pairs.

How Has This Been Tested?

Existing tests for Vectorizer were updated to reflect the new attribute names, and those tests all pass. Haven't added any tests specifically for GroupVectorizer — yet. New tests were added for both Vectorizer and GroupVectorizer, and they also pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation, and I have updated it accordingly.

@bdewilde bdewilde merged commit e2b7926 into master Jan 16, 2018
@bdewilde bdewilde deleted the grp-term-matrix-vectorization branch January 16, 2018 04:52
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.

1 participant