-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Fix Pipeline #1213
Fix Pipeline #1213
Changes from 2 commits
8098e56
40ffca0
36b8a81
7391fcc
efe96e6
a133b49
970df21
768e39b
3bccc20
b709026
6d15ae7
de600ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import numpy | ||
|
||
from scipy import sparse | ||
from sklearn.pipeline import Pipeline | ||
from gensim.sklearn_integration.sklearn_wrapper_gensim_ldamodel import SklearnWrapperLdaModel | ||
from gensim.corpora import Dictionary | ||
from gensim import matutils | ||
|
@@ -67,5 +68,15 @@ def testCSRMatrixConversion(self): | |
self.assertTrue(isinstance(v, six.string_types)) | ||
self.assertTrue(isinstance(k, int)) | ||
|
||
def testPipline(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo in name of the function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo in test name |
||
model = SklearnWrapperLdaModel(id2word=dictionary, num_topics=2, passes=100, minimum_probability=0, random_state=numpy.random.seed(0)) | ||
text_lda = Pipeline([('model', model)]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can a pipeline contain two things? From lda to logistic regression would be good. Also could you please add it to the tutorial. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do, you mean to say that we use lda as a feature extractor. And then use it to in the logistic regression. I thought of this and modified the transform function accordingly. |
||
text_lda.fit(corpus) | ||
topic = text_lda.named_steps['model'].print_topics(2) | ||
for k, v in topic: | ||
self.assertTrue(isinstance(v, six.string_types)) | ||
self.assertTrue(isinstance(k, int)) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gridsearch returns exception in the ipynb. Is it possible to have it fixed?