<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Introduction to Logistic Regression
Learning Objectives
Create Seaborn plots for Exploratory Data Analysis 
Train a Logistic Regression Model using Scikit-Learn
Introduction
This lab is in introduction to logistic regression using Python and Scikit-Learn.  This lab serves as a foundation for more complex algorithms and machine learning models that you will encounter in the course. In this lab, we will use a synthetic advertising data set, indicating whether or not a particular internet user clicked on an Advertisement on a company website. We will try to create a model that will predict whether or not they will click on an ad based off the features of that user.  
Each learning objective will correspond to a #TODO in this student lab notebook -- try to complete this notebook first and then review the solution notebook. 
Import Libraries
Step1:  Load the Dataset
We will use a synthetic advertising dataset.  This data set contains the following features
Step2:  Check the head of ad_data
Step3:  Use info and describe() on ad_data
Step4:  Let's check for any null values.
Step5:  Exploratory Data Analysis (EDA)
Let's use seaborn to explore the data!  Try recreating the plots shown below!
TODO 1
Step6:  TODO 1
Step7:  TODO 2
Step8:  TODO 1
Step9:  Logistic Regression
Logistic regression is a supervised machine learning process.  It is similar to linear regression, but rather than predict a continuous value, we try to  estimate probabilities by using a logistic function.  Note that even though it has regression in the name, it is for classification.
While linear regression is acceptable for estimating values, logistic regression is best for predicting the class of an observation
Now it's time to do a train test split, and train our model!  You'll have the freedom here to choose columns that you want to train on!
Step10:  Next, let's define the features and label.  Briefly, feature is input; label is output. This applies to both classification and regression problems.
Step11:  TODO 2
Step12:  Train and fit a logistic regression model on the training set.
Step13:  Predictions and Evaluations
Now predict values for the testing data.
Step14:  Create a classification report for the model.
<ASSISTANT_TASK:>
Python Code:
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
%matplotlib inline
Explanation: Introduction to Logistic Regression
Learning Objectives
Create Seaborn plots for Exploratory Data Analysis 
Train a Logistic Regression Model using Scikit-Learn
Introduction
This lab is in introduction to logistic regression using Python and Scikit-Learn.  This lab serves as a foundation for more complex algorithms and machine learning models that you will encounter in the course. In this lab, we will use a synthetic advertising data set, indicating whether or not a particular internet user clicked on an Advertisement on a company website. We will try to create a model that will predict whether or not they will click on an ad based off the features of that user.  
Each learning objective will correspond to a #TODO in this student lab notebook -- try to complete this notebook first and then review the solution notebook. 
Import Libraries
End of explanation
# TODO 1: Read in the advertising.csv file and set it to a data frame called ad_data.
# TODO: Your code goes here
Explanation: Load the Dataset
We will use a synthetic advertising dataset.  This data set contains the following features:
'Daily Time Spent on Site': consumer time on site in minutes
'Age': customer age in years
'Area Income': Avg. Income of geographical area of consumer
'Daily Internet Usage': Avg. minutes a day consumer is on the internet
'Ad Topic Line': Headline of the advertisement
'City': City of consumer
'Male': Whether or not consumer was male
'Country': Country of consumer
'Timestamp': Time at which consumer clicked on Ad or closed window
'Clicked on Ad': 0 or 1 indicated clicking on Ad
End of explanation
ad_data.head()
Explanation: Check the head of ad_data
End of explanation
ad_data.info()
ad_data.describe()
Explanation: Use info and describe() on ad_data
End of explanation
ad_data.isnull().sum()
Explanation: Let's check for any null values.
End of explanation
# TODO: Your code goes here
Explanation: Exploratory Data Analysis (EDA)
Let's use seaborn to explore the data!  Try recreating the plots shown below!
TODO 1:  Create a histogram of the Age
End of explanation
# TODO: Your code goes here
Explanation: TODO 1:  Create a jointplot showing Area Income versus Age.
End of explanation
# TODO: Your code goes here
Explanation: TODO 2:  Create a jointplot showing the kde distributions of Daily Time spent on site vs. Age.
End of explanation
# TODO: Your code goes here
Explanation: TODO 1: Create a jointplot of 'Daily Time Spent on Site' vs. 'Daily Internet Usage'
End of explanation
from sklearn.model_selection import train_test_split
Explanation: Logistic Regression
Logistic regression is a supervised machine learning process.  It is similar to linear regression, but rather than predict a continuous value, we try to  estimate probabilities by using a logistic function.  Note that even though it has regression in the name, it is for classification.
While linear regression is acceptable for estimating values, logistic regression is best for predicting the class of an observation
Now it's time to do a train test split, and train our model!  You'll have the freedom here to choose columns that you want to train on!
End of explanation
X = ad_data[
    [
        "Daily Time Spent on Site",
        "Age",
        "Area Income",
        "Daily Internet Usage",
        "Male",
    ]
]
y = ad_data["Clicked on Ad"]
Explanation: Next, let's define the features and label.  Briefly, feature is input; label is output. This applies to both classification and regression problems.
End of explanation
# TODO: Your code goes here
Explanation: TODO 2: Split the data into training set and testing set using train_test_split
End of explanation
from sklearn.linear_model import LogisticRegression
logmodel = LogisticRegression()
logmodel.fit(X_train, y_train)
Explanation: Train and fit a logistic regression model on the training set.
End of explanation
predictions = logmodel.predict(X_test)
Explanation: Predictions and Evaluations
Now predict values for the testing data.
End of explanation
from sklearn.metrics import classification_report
print(classification_report(y_test, predictions))
Explanation: Create a classification report for the model.
End of explanation
<END_TASK>