0% found this document useful (0 votes)
2 views4 pages

Logistic Regression Implementation

The document outlines the implementation of logistic regression, which is used to predict categorical outcomes based on input variables. It describes a model predicting automobile purchases using factors like age and income, and details the steps for implementing logistic regression, including data visualization and confusion matrix analysis. The confusion matrix is provided, showing the accuracy of predictions made by the model.

Uploaded by

shruti04058
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Logistic Regression Implementation

The document outlines the implementation of logistic regression, which is used to predict categorical outcomes based on input variables. It describes a model predicting automobile purchases using factors like age and income, and details the steps for implementing logistic regression, including data visualization and confusion matrix analysis. The confusion matrix is provided, showing the accuracy of predictions made by the model.

Uploaded by

shruti04058
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Logistic Regression Implementation

Logistic Regression:
 When the outcome variable is categorical in nature, logistic regression can be used
to predict the likelihood of an outcome based on the input variables.
 Although logistic regression can be applied to an outcome variable that represents
multiple values, but we will examine the case in which the outcome variable
represents two values such as true/false, pass/fail, or yes/no.

Logistic Regression Model:

 A logistic regression model can be built to determine if a person will or will not
purchase a new automobile in the next 12 months.
 The training set could include input variables for a person's age, income, and
gender as well as the age of an existing automobile.
 The training set would also include the outcome variable on whether the person
purchased a new automobile over a 12-month period.
 The logistic regression model provides the likelihood or probability of a person
making a purchase in the next 12 months..

Linear Regression Implementation:


The steps to implement linear regression includes:
Step 1: Import the required modules.
Step 2: Generate Dataset.
Step 3: Visualize the Data.
Step 4:Split the dataset.
Step 5: Perform logistic regression.
Step 6: Make prediction using the model
Step 7: Display the confusion matrix

Rutuja Kadam Sathaye College


Code:

Rutuja Kadam Sathaye College


Output:
Figure 1: Displays the logistic regression coefficient and intercept, the predicted y value and
the confusion matrix.

The confusion matrix is displayed as:


[[ 9 1
1 14]]
Where,
 9 represents the number of positive true values we predicted correctly.
 14 represents number of negative true values we predicted correctly.
 1 represents number of positive values we predicted incorrectly.
 1 represents number of negative values we predicted incorrectly.
Figure 2: Plotting a scatter plot of Logistic Regression.

Rutuja Kadam Sathaye College

You might also like