Agile Data Science - Building a Regression Model



Logistic Regression refers to the machine learning algorithm that is utilized to predict the probability of categorical dependent variable. In logistic regression, the dependent variable is binary variable, which comprises of data coded as 1 (Boolean values of valid and false).

In this section, we will concentrate on developing a regression model in Python utilizing continuous variable. The example for linear regression model will focus on data exploration from CSV file.

The classification goal is to anticipate whether the customer will subscribe (1/0) to a term deposit.

import pandas as pd
import numpy as np
from sklearn import preprocessing
import matplotlib.pyplot as plt

plt.rc("font", size=14)
from sklearn.linear_model import LogisticRegression
from sklearn.cross_validation import train_test_split

import seaborn as sns
sns.set(style="white")
sns.set(style="whitegrid", color_codes=True)
data = pd.read_csv('bank.csv', header=0)
data = data.dropna()
print(data.shape)
print(list(data.columns))

Follow these steps to actualize the above code in Anaconda Navigator with “Jupyter Notebook” −

Step 1 − Launch the Jupyter Notebook with Anaconda Navigator.

jupyter_notebook_first

jupyter_notebook_second

Step 2 − Upload the csv document to get the output of regression model in systematic manner.

jupyter_notebook_third

Step 3 − Create a new file and execute the previously mentioned code line to get the desired output.

jupyter_notebook_fourth

jupyter_notebook_fifth





Input your Topic Name and press Enter.