Project - Building Spam Classifier

You are currently auditing this course.
25 / 27

Spam Classifier - Train a LogisticRegression model on the Dataset

Now we will train a LogisticRegression model on the dataset, and see how it performs.

INSTRUCTIONS
  • Import LogisticRegression and cross_val_score from Scikit-learn's linear_model and model_selection respectively:

    from sklearn.linear_model import << your code goes here >>
    from sklearn.<< your code goes here>> import cross_val_score
    
  • Next, let's train the LogisticRegression model:

    log_clf = << your code goes here >>(solver="lbfgs", random_state=42)
    
  • Finally, let us calculate the cross validation score, and the mean score:

    score = << your code goes here >>(log_clf, X_train_transformed, y_train, cv=3, verbose=3)
    score.mean()
    
Get Hint See Answer

Loading comments...