Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Instructions Read through this blog and the Logistic _ Regression.ipynb file that comes with this task as guides to applying Logistic Regression. Read this article

Instructions
Read through this blog and the Logistic_Regression.ipynb file that comes
with this task as guides to applying Logistic Regression.
Read this article from Datacamp to learn about preprocessing categorical
variables.
Compulsory Task 1
Follow these steps:
Begin by reading the Iris data set (Iris.csv) into a Jupyter notebook and
name it iris_logistic_regression.ipynb.
The dataset consists of three classes of irises. The objective is to create a
classifier that will predict whether an iris belongs to the 'Iris-setosa' class
or not.
This means that we have two classes: 'Iris-setosa' and not-'Iris-setosa'
(which includes 'Iris-versicolor' and 'Iris-virginica').
Identify your independent variables x.
Encode your dependent variable y such that 'Iris-setosa' is encoded
as 0, and 'Iris-versicolor' and 'Iris-virginica' are both encoded as
(0 corresponds to the 'Iris-setosa' class, and 1 corresponds to the
not-'Iris-setosa' class.)
Split the data into a training and test set.
Use sklearn's logistic regression function to fit a model and make
predictions on the test set.
Use sklearn to generate a confusion matrix, which compares the
predicted labels to the actual labels (gold labels).
Analyse the confusion matrix and provide a prediction, in a comment, whether the model is likely to have hgher precison, higher recall or similar precison and recall. Write your own code to calulate the accuracy, precision and recall, and check whether your prediction was right
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions