Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q3. (30 marks) Consider the file 'carehome_records.csv' on VLE (Assessment - Lab Assessment). The file has health records of elderly people living in a care

image text in transcribedimage text in transcribed

Q3. (30 marks) Consider the file 'carehome_records.csv' on VLE (Assessment - Lab Assessment). The file has health records of elderly people living in a care home, where each row contains the number of steps walked, whether the person slept well (or not), ate well (or not), had fever (or not), and had headache (or not). The last column shows whether the doctor finds the person in good health overall or not. F and 0 represent False, and T and 1 represent True. We want to build a logistic regression model in Python to predict whether a person is in good health, based on all the other attributes of a person in the same row. Task: Using Jupyter Notebook for Python: (i) [2 marks] Read the given CSV data in a dataframe. (ii) [9 marks] Divide the complete data into a training set and a test set. You should use 70% of the given data for training and the remaining 30% for testing. Write down the code to train a logistic regression model on the training set. (iii) [3 marks] Use the trained model to predict and show the class of instances in the test dataset. (iv) [4 marks] With regards to the test dataset, write down the code to create a new column 'Predicted Class' next to the column 'Actual Class' and show the actual vs predicted class for each record. As an example: (v) [6 marks] Calculate the accuracy, precision, recall, and f-score of your logistic regression model. (vi) [3 marks] A person in the care home walked 122 steps, slept well and ate well, but had a severe headache without fever. Use the trained model to predict whether the person is in good health or not. [3 marks] The doctor finds that the person referred in (vi) is in good health. The details of this person need to be added to the test dataset generated in (iv). Show the code to insert these details as a row into the test dataset at index 27

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions