Chapter 6: Model Evaluation
Activity 11: Computing Accuracy and Null Accuracy of Neural Network When We Change the Train/Test Split
Solution:
- Import the required libraries. Load and explore the dataset:
#import the libraries import numpy as np import pandas as pd
#Load the Data patient_data=pd.read_csv(“Health_Data.csv”)##use the head function to get a glimpse data patient_data.head()
The following figure shows the output of the preceding code:
Figure 6.30: A screenshot of the patient readmission dataset
- Separate the independent and dependent variables. Since column 0, the patient_id column, does not add any value, we discard that column. Columns 1 to 8 are independent variables, and the last column is the dependent variable.
The following figure shows the output of the preceding code:
mydata=pd.read_csv(“Health_Data.csv”)X=mydata.iloc[:,1:9]y=mydata.iloc[:,9]
X.head()
- Create dummy variables for the categorical variables. Note that the input should all be...