<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Acute Inflammations Dataset - UCI
Analysis of the UCI dataset https
Step1:  Attribute Information
a1 Temperature of patient { 35C-42C }
a2 Occurrence of nausea { yes, no }
a3 Lumbar pain { yes, no }
a4 Urine pushing (continuous need for urination) { yes, no }
a5 Micturition pains { yes, no }
a6 Burning of urethra, itch, swelling of urethra outlet { yes, no }
d1 decision
Step2:  Bivariate Analysis - Inflammation
Step3:  The Logistic Regression Model for Inflammation
Step4:  Bivariate Analysis - Nephritis
Step5:  The Logistic Regression Model for Nephritis
<ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
%pylab inline
pylab.style.use('ggplot')
import seaborn as sns
data_df = pd.read_csv('diagnosis.csv', sep='\t', decimal=',', header=None)
data_df.head()
Explanation: Acute Inflammations Dataset - UCI
Analysis of the UCI dataset https://archive.ics.uci.edu/ml/datasets/Acute+Inflammations.
End of explanation
data_df.columns = ['temp', 'nausea', 'lumber_pain', 'urine_pushing', 'micturiation_pain', 
                  'burning', 'inflammation', 'nephritis']
for c in data_df.columns[1:]:
    data_df.loc[:, c] =  data_df.loc[:, c].map(lambda v : 1.0 if v == 'yes' else 0.0) 
data_df.head()
feature_df = data_df.loc[:, data_df.columns[:-2]]
target_df = data_df.loc[:, data_df.columns[-2:]]
feature_df.head()
target_df.head()
Explanation: Attribute Information
a1 Temperature of patient { 35C-42C }
a2 Occurrence of nausea { yes, no }
a3 Lumbar pain { yes, no }
a4 Urine pushing (continuous need for urination) { yes, no }
a5 Micturition pains { yes, no }
a6 Burning of urethra, itch, swelling of urethra outlet { yes, no }
d1 decision: Inflammation of urinary bladder { yes, no }
d2 decision: Nephritis of renal pelvis origin { yes, no }
End of explanation
sns.lmplot(data=data_df, x='temp', hue='inflammation', y='inflammation', fit_reg=False) 
for fname in feature_df.columns[1:]:
    pylab.figure()
    sns.countplot(y=fname, hue="inflammation", data=data_df)
Explanation: Bivariate Analysis - Inflammation
End of explanation
import statsmodels.formula.api as sm
inflammation_model = sm.logit(
    formula='inflammation ~ lumber_pain + urine_pushing + micturiation_pain',
    data=data_df
)
inflammation_result = inflammation_model.fit(method='lbfgs')
inflammation_result.summary()                
Explanation: The Logistic Regression Model for Inflammation
End of explanation
sns.lmplot(data=data_df, x='temp', hue='nephritis', y='nephritis', fit_reg=False) 
for fname in feature_df.columns[1:]:
    pylab.figure()
    sns.countplot(y=fname, hue="nephritis", data=data_df)
Explanation: Bivariate Analysis - Nephritis
End of explanation
nephritis_model = sm.ols(
    formula='nephritis ~ temp + nausea + urine_pushing + lumber_pain + burning',
    data=data_df
)
nephritis_result = nephritis_model.fit()
nephritis_result.summary()
Explanation: The Logistic Regression Model for Nephritis
End of explanation
<END_TASK>