Andika Atmanegara Putra commited on
Commit
dba73d1
1 Parent(s): 743132f

add markdown, add eda,

__pycache__/eda.cpython-311.pyc ADDED
Binary file (5.28 kB). View file
 
__pycache__/prediction.cpython-311.pyc ADDED
Binary file (5.56 kB). View file
 
eda.py CHANGED
@@ -28,7 +28,29 @@ def run():
28
  insight yang dapat menjadi faktor-faktor / variabel yang membuat seorang
29
  pasien dapat diprediksi meninggal atau tidak.
30
  '''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  st.markdown('---')
 
 
32
  st.subheader('Explorasi Data')
33
  st.markdown('---')
34
 
@@ -50,5 +72,21 @@ def run():
50
  sns.histplot(data[choice], bins=30, kde=True)
51
  st.pyplot(fig)
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  if __name__ == '__main__':
54
  run()
 
28
  insight yang dapat menjadi faktor-faktor / variabel yang membuat seorang
29
  pasien dapat diprediksi meninggal atau tidak.
30
  '''
31
+ markdown_text = '''
32
+ ## Variable Descriptions
33
+ | Variable | Description |
34
+ |-------------------------|-----------------------------------------------------------------------------------------------|
35
+ | age | Age of the patient in years. |
36
+ | anaemia | Whether the patient has anemia or not. (1=True, 0=False) |
37
+ | creatinine_phosphokinase| Level of the enzyme creatinine phosphokinase in the patient's blood in units (mcg/L). |
38
+ | diabetes | Whether the patient has diabetes or not. (1=True, 0=False) |
39
+ | ejection_fraction | Percentage of blood volume ejected from the heart during each contraction. |
40
+ | high_blood_pressure | Whether the patient has high blood pressure or not. (1=True, 0=False) |
41
+ | platelets | Level of platelets in the patient's blood in units (kiloplatelets/mL). |
42
+ | serum_creatinine | Level of creatinine in the patient's blood in units (mg/dL). |
43
+ | serum_sodium | Level of sodium in the patient's blood in units (mEq/L). |
44
+ | sex | Gender of the patient. (0=Male, 1=Female) |
45
+ | smoking | Whether the patient smokes or not. (1=True, 0=False) |
46
+ | time | Follow-up period in days. |
47
+ | DEATH_EVENT | Indicator of whether the patient experienced a death event or not. (1=True, 0=False) |
48
+ '''
49
+
50
+ st.markdown(markdown_text)
51
  st.markdown('---')
52
+
53
+
54
  st.subheader('Explorasi Data')
55
  st.markdown('---')
56
 
 
72
  sns.histplot(data[choice], bins=30, kde=True)
73
  st.pyplot(fig)
74
 
75
+ # visual 2
76
+ ## Categorical Data Plot
77
+ st.write('### Categorical Data Ratio')
78
+ pilihan_kategori = st.selectbox('Pick Categorical Column : ', ('anaemia', 'diabetes', 'high_blood_pressure',
79
+ 'sex', 'smoking'))
80
+
81
+ fig= plt.figure(figsize=(8, 6))
82
+ sns.countplot(data=data, x=pilihan_kategori, hue='DEATH_EVENT', palette=['limegreen', 'firebrick'])
83
+
84
+ plt.xlabel(pilihan_kategori.capitalize())
85
+ plt.ylabel('Count')
86
+ plt.title(pilihan_kategori.capitalize()+' Ratio')
87
+ plt.legend(title='DEATH_EVENT')
88
+
89
+ st.pyplot(fig)
90
+
91
  if __name__ == '__main__':
92
  run()
prediction.py CHANGED
@@ -78,6 +78,10 @@ def run():
78
  'smoking': smoking,
79
  'time': time,
80
  }
 
 
 
 
81
 
82
  data_inf = pd.DataFrame([data_inf])
83
  st.dataframe(data_inf)
@@ -98,6 +102,5 @@ def run():
98
 
99
  st.write('Prediction: ', (y_pred_inf))
100
 
101
-
102
  if __name__ == '__main__':
103
  run()
 
78
  'smoking': smoking,
79
  'time': time,
80
  }
81
+
82
+ st.markdown('Jika Hasil Prediksi = 1, maka model memprediksi bahwa pasien akan meninggal.')
83
+ st.markdown('Jika Hasil Prediksi = 1, maka model memprediksi bahwa pasien akan meninggal.')
84
+
85
 
86
  data_inf = pd.DataFrame([data_inf])
87
  st.dataframe(data_inf)
 
102
 
103
  st.write('Prediction: ', (y_pred_inf))
104
 
 
105
  if __name__ == '__main__':
106
  run()