November 2018
Beginner to intermediate
182 pages
4h 48m
English
Let's now simply replicate the simple logistic regression we did in Chapter 1, Getting Started with Text Classification, but on our custom dataset, as follows:
from sklearn.linear_model import LogisticRegression as LRlr_clf = Pipeline([('vect', CountVectorizer()), ('tfidf', TfidfTransformer()), ('clf',LR())])
As you can see in the preceding snippet, lr_clf becomes our classifier pipeline. We saw the pipeline in our introductory section. A pipeline allows us to queue multiple operations in one single Python object.
lr_clf.fit(X=X_train, ...
Read now
Unlock full access