Answered step by step
Verified Expert Solution
Question
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 LogisticRegression.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
Follow these steps:
Begin by reading the Iris data set Iriscsv into a Jupyter notebook and
name it irislogisticregression.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 'Irissetosa' class
or not.
This means that we have two classes: 'Irissetosa' and not'Irissetosa'
which includes 'Irisversicolor' and 'Irisvirginica'
Identify your independent variables
Encode your dependent variable such that 'Irissetosa' is encoded
as and 'Irisversicolor' and 'Irisvirginica' are both encoded as
corresponds to the 'Irissetosa' class, and corresponds to the
not'Irissetosa' 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started