Pain level

Pain is a common indication that something is wrong with the human body, and pain level is usually asked in every medical interview, whether it is the initial history and physical or the daily SOAP note. Pain levels are usually reported on a scale from 0 (non-existent) to 10 (unbearable). Let's first convert the PAINSCALE column to the numeric type:

X_train.loc[:,'PAINSCALE'] = X_train.loc[:,'PAINSCALE'].apply(pd.to_numeric)
X_test.loc[:,'PAINSCALE'] = X_test.loc[:,'PAINSCALE'].apply(pd.to_numeric)

Now, we have to write a separate function for mean-imputing pain values, since it uses -8 as a placeholder value instead of -7:

def mean_impute_pain(data,col): 
temp_mean = data.loc[(data[col] != -8) & (data[col] != -9), col].mean()
data.loc[(data[col] == -8) | (data[col] == -9), col] = temp_mean
return data

X_train = mean_impute_pain(X_train,'PAINSCALE')
X_test = mean_impute_pain(X_test,'PAINSCALE')

Together, vital signs provide an important picture of the health of the patient. In the end, we will see how important a role these variables play when we do the variable importance.

Now, we can move on to the next variable category.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset