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

Support using CountVectorizer & TfidVectorizer in cuml.pipeline.Pipeline #5034

Merged
merged 3 commits into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
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: 3 additions & 1 deletion python/cuml/feature_extraction/_tfidf_vectorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def fit(self, raw_documents):
self._tfidf.fit(X)
return self

def fit_transform(self, raw_documents):
def fit_transform(self, raw_documents, y=None):
"""Learn vocabulary and idf, return document-term matrix.
This is equivalent to fit followed by transform, but more efficiently
implemented.
Expand All @@ -227,6 +227,8 @@ def fit_transform(self, raw_documents):
----------
raw_documents : cudf.Series or pd.Series
A Series of string documents
y : None
Ignored.

Returns
-------
Expand Down
8 changes: 6 additions & 2 deletions python/cuml/feature_extraction/_vectorizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def _preprocess(self, raw_documents):
preprocess = self.build_preprocessor()
return preprocess(raw_documents)

def fit(self, raw_documents):
def fit(self, raw_documents, y=None):
"""
Build a vocabulary of all tokens in the raw documents.

Expand All @@ -518,6 +518,8 @@ def fit(self, raw_documents):

raw_documents : cudf.Series or pd.Series
A Series of string documents
y : None
Ignored.

Returns
-------
Expand All @@ -527,7 +529,7 @@ def fit(self, raw_documents):
self.fit_transform(raw_documents)
return self

def fit_transform(self, raw_documents):
def fit_transform(self, raw_documents, y=None):
"""
Build the vocabulary and return document-term matrix.

Expand All @@ -538,6 +540,8 @@ def fit_transform(self, raw_documents):
----------
raw_documents : cudf.Series or pd.Series
A Series of string documents
y : None
Ignored.

Returns
-------
Expand Down