Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python to do this assignment Sorry, I couldn't attach excel file, so could you please just use the data in the pics to solve

Using Python to do this assignment

image text in transcribed

image text in transcribed

Sorry, I couldn't attach excel file, so could you please just use the data in the pics to solve this question

Question #1 1. Download the heart.csv dataset from the Blackboard and use read csv() to read it. 2. Creat a new column named 'age_cat' in the DataFrame to present individuals' age with 4 categories. Here is the list of categories: 25-40 .40-55 55-70 70+ 3. Creat a pie chart to show the percentage of individuals in each age category . Use the Explode feature of pie chart in matplotlib to separate the age category of 40 4. Creat a histogram with with 20 bins and white edgecolor to visualize the distribution of "chol" feature. Then use the annotation function to point to the bin with the highest value 5. Use logistic regression to create a predictive model . Use 70% of data for tanning and consider 30% of data for testing. (Use random_state-0) . Use all features (13 features in the orignal dataset, you don't need to use age_cat) to creat your predictive model traget is your dependent variable. It shows whether the subject suffers form a heart disease or not. 6. Use similar structure as above to create a naive bayes predictive model 7. Use in-sample data (train data) and out-of-sample data (test data) to check the accuracy of your naive bayes model . What is the general expectation? should we expect to get higher accuray on in-sample data or out-of-sample data What is the result in your case? 8. Find precision, recall and F1 scores for both logistic regression and naive bayes models using out-of-sample data (test data) and explain which one works better than the other? 1222212332222222222232223222 0000000000000000000200000200 0022211222222121202212212222 3548643056226816065854014466 2310001 011001-21100 1010 0000100000000100000001011000 3324 6 4111 878 1000000010000010000000010010 6139 679 363 2112222 2 2 2 331 0 p111 1e 3211001122021332230302023122 2 5 1 1 2 5 123456789 012345678901 4 8 Question #1 1. Download the heart.csv dataset from the Blackboard and use read csv() to read it. 2. Creat a new column named 'age_cat' in the DataFrame to present individuals' age with 4 categories. Here is the list of categories: 25-40 .40-55 55-70 70+ 3. Creat a pie chart to show the percentage of individuals in each age category . Use the Explode feature of pie chart in matplotlib to separate the age category of 40 4. Creat a histogram with with 20 bins and white edgecolor to visualize the distribution of "chol" feature. Then use the annotation function to point to the bin with the highest value 5. Use logistic regression to create a predictive model . Use 70% of data for tanning and consider 30% of data for testing. (Use random_state-0) . Use all features (13 features in the orignal dataset, you don't need to use age_cat) to creat your predictive model traget is your dependent variable. It shows whether the subject suffers form a heart disease or not. 6. Use similar structure as above to create a naive bayes predictive model 7. Use in-sample data (train data) and out-of-sample data (test data) to check the accuracy of your naive bayes model . What is the general expectation? should we expect to get higher accuray on in-sample data or out-of-sample data What is the result in your case? 8. Find precision, recall and F1 scores for both logistic regression and naive bayes models using out-of-sample data (test data) and explain which one works better than the other? 1222212332222222222232223222 0000000000000000000200000200 0022211222222121202212212222 3548643056226816065854014466 2310001 011001-21100 1010 0000100000000100000001011000 3324 6 4111 878 1000000010000010000000010010 6139 679 363 2112222 2 2 2 331 0 p111 1e 3211001122021332230302023122 2 5 1 1 2 5 123456789 012345678901 4 8

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

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions