Building a Regression Model


Advertisements

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

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

The classification goal is to predict whether the client 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 implement 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 file to get the output of regression model in systematic manner.

Jupyter Notebook Third

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

Jupyter Notebook Fourth

Jupyter Notebook Fifth

Useful Video Courses


Video

Agile Methodology

14 Lectures 1 hours

Mahesh Kumar

Video

Agile Project Management: Scrum Step by Step with Examples

61 Lectures 1 hours

Paul Ashun

Video

Agile Vs Waterfall project methodologies comparison

7 Lectures 25 mins

Angelo Tofalo

Video

Agile for Security Teams

19 Lectures 1.5 hours

Cristina Gheorghisan

Video

Agile Project Management: Agile, Scrum, Kanban & XP

Featured

50 Lectures 4 hours

Monika Rawat

Advertisements