Path: blob/main/C1 - Supervised Machine Learning - Regression and Classification/week3/Optional Labs/C1_W3_Lab07_Scikit_Learn_Soln.ipynb
3748 views
Kernel: Python 3
Ungraded Lab: Logistic Regression using Scikit-Learn
Goals
In this lab you will:
Train a logistic regression model using scikit-learn.
Dataset
Let's start with the same dataset as before.
In [1]:
Fit the model
The code below imports the logistic regression model from scikit-learn. You can fit this model on the training data by calling fit
function.
In [2]:
Out[2]:
LogisticRegression()
Make Predictions
You can see the predictions made by this model by calling the predict
function.
In [3]:
Out[3]:
Prediction on training set: [0 0 0 1 1 1]
Calculate accuracy
You can calculate this accuracy of this model by calling the score
function.
In [4]:
Out[4]:
Accuracy on training set: 1.0