fadyabila commited on
Commit
989554d
1 Parent(s): a06c495

submission

Browse files
Files changed (2) hide show
  1. eda.py +41 -7
  2. prediction.py +13 -12
eda.py CHANGED
@@ -22,14 +22,14 @@ def run():
22
 
23
  # Menambahkan Deskripsi
24
  st.write('## Background')
25
- st.write('Hepatitis C is a very dangerous and contagious disease, which is caused by the Hepatitis C virus (HCV).'
26
- ' Transmission of Hepatitis C can be through body fluids, blood, or when having sex with sufferers.'
27
- ' Usually, the symptoms of Hepatitis C are not visible, so suddenly the sufferer or patient has experienced the chronic stage of hepatitis.'
28
- ' Hepatitis C can also trigger the onset of fibrosis which causes cirrhosis and liver cancer.'
29
 
30
- ' Therefore, the Liver Hospital must have adequate facilities and treatment to treat patients with indications and symptoms of Hepatitis C.'
31
- ' The purpose of this data classification analysis and modeling is to find out what the diagnoses are in patients so that they receive further treatment, can be cured, and minimize death.'
32
- ' This modeling uses 4 Machine Learning (Supervised) algorithms, namely Logistic Regression, Support Vector Machine, Random Forest, and Gradient Boosting to get the best predictions with hyperparameter tuning.')
33
 
34
  st.write('## Dataset')
35
  st.write("""
@@ -66,6 +66,40 @@ def run():
66
  sns.countplot(x='Category', data=df1, palette="PuRd")
67
  st.pyplot(fig)
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  # Membuat heatmap correlation
70
  st.write('#### Heatmap Correlation')
71
  fig = plt.figure(figsize = (15,8))
 
22
 
23
  # Menambahkan Deskripsi
24
  st.write('## Background')
25
+ st.write(""" Hepatitis C is a very dangerous and contagious disease, which is caused by the Hepatitis C virus (HCV).
26
+ Transmission of Hepatitis C can be through body fluids, blood, or when having sex with sufferers.
27
+ Usually, the symptoms of Hepatitis C are not visible, so suddenly the sufferer or patient has experienced the chronic stage of hepatitis.
28
+ Hepatitis C can also trigger the onset of fibrosis which causes cirrhosis and liver cancer.
29
 
30
+ Therefore, the Liver Hospital must have adequate facilities and treatment to treat patients with indications and symptoms of Hepatitis C.
31
+ The purpose of this data classification analysis and modeling is to find out what the diagnoses are in patients so that they receive further treatment, can be cured, and minimize death.
32
+ This modeling uses 4 Machine Learning (Supervised) algorithms, namely Logistic Regression, Support Vector Machine, Random Forest, and Gradient Boosting to get the best predictions with hyperparameter tuning.""")
33
 
34
  st.write('## Dataset')
35
  st.write("""
 
66
  sns.countplot(x='Category', data=df1, palette="PuRd")
67
  st.pyplot(fig)
68
 
69
+ st.write('#### Sex Based on Diagnose')
70
+ fig1, ax1 = plt.subplots(figsize=(15, 8))
71
+ sns.countplot(x='Sex', hue='Category', data=df1, ax=ax1)
72
+ st.pyplot(fig1)
73
+
74
+ # Mengelompokkan Usia
75
+ bins = [18, 30, 40, 50, 60, 70, 120]
76
+ labels = ['20-29', '30-39', '40-49', '50-59', '60-69', '70-80']
77
+ df1['agerange'] = pd.cut(df1.Age, bins, labels = labels,include_lowest = True)
78
+
79
+ # Menampilkan visualisasi usia berdasarkan diagnosis
80
+ st.write('#### Age Based on Diagnose')
81
+ fig2, ax2 = plt.subplots(figsize=(10,7))
82
+ sns.countplot(x='agerange', data=df1, hue="Category", ax=ax2)
83
+ st.pyplot(fig2)
84
+
85
+ # Rata-rata AST berdasarkan diagnosis
86
+ AST = df1.groupby('Category').agg({'AST':'mean'}).reset_index()
87
+ AST = AST.sort_values(by='AST')
88
+ # Menampilkan visualisasi bar chart
89
+ st.write('#### AST Mean Based on Diagnose')
90
+ fig3, ax3 = plt.subplots(figsize=(10,7))
91
+ sns.barplot(data=AST, x=AST.Category, y=AST.AST, ax=ax3)
92
+ st.pyplot(fig3)
93
+
94
+ # Rata-rata CHE berdasarkan diagnosis
95
+ CHE = df1.groupby('Category').agg({'CHE':'mean'}).reset_index()
96
+ CHE = CHE.sort_values(by='CHE')
97
+ # Menampilkan visualisasi bar chart
98
+ st.write('#### CHE Mean Based on Diagnose')
99
+ fig4, ax4 = plt.subplots(figsize=(10,7))
100
+ sns.barplot(data=CHE, x=CHE.Category, y=CHE.CHE, ax=ax4)
101
+ st.pyplot(fig4)
102
+
103
  # Membuat heatmap correlation
104
  st.write('#### Heatmap Correlation')
105
  fig = plt.figure(figsize = (15,8))
prediction.py CHANGED
@@ -26,24 +26,25 @@ with open('enc_columns.txt', 'r') as file_6:
26
 
27
  def run():
28
  with st.form(key='Hepatitis_C_Prediction'):
29
- Category = st.selectbox('Category', (0, 1, 2, 3, 4), index=1)
 
30
  Age = st.number_input('Age', min_value=23, max_value=80, value=23)
31
- Sex = st.selectbox('Sex', ('m', 'f'), index=1)
32
  st.markdown('---')
33
 
34
- ALB = st.number_input('ALB', min_value=0, max_value=500, value=0)
35
- ALP = st.number_input('ALP', min_value=0, max_value=500, value=0)
36
- ALT = st.number_input('ALT', min_value=0, max_value=500, value=0)
37
- AST = st.number_input('AST', min_value=0, max_value=500, value=0)
38
- BIL = st.number_input('BIL', min_value=0, max_value=500, value=0)
39
 
40
  st.markdown('---')
41
 
42
- CHE = st.number_input('CHE', min_value=0, max_value=100, value=0)
43
- CHOL = st.number_input('CHOL', min_value=0, max_value=100, value=0)
44
- CREA = st.number_input('CREA', min_value=0, max_value=1000, value=0)
45
- GGT = st.number_input('GGT', min_value=0, max_value=1000, value=0)
46
- PROT = st.number_input('PROT', min_value=0, max_value=1000, value=0)
47
 
48
  submitted = st.form_submit_button('Predict')
49
 
 
26
 
27
  def run():
28
  with st.form(key='Hepatitis_C_Prediction'):
29
+ Category = st.selectbox('Category', ('0=Blood Donor', '1=suspect Blood Donor',
30
+ '2=Hepatitis', '3=Fibrosis', '4=Chirrosis'), index=1)
31
  Age = st.number_input('Age', min_value=23, max_value=80, value=23)
32
+ Sex = st.selectbox('Sex', ('Male', 'Female'), index=1)
33
  st.markdown('---')
34
 
35
+ ALB = st.number_input('ALB', min_value=0, max_value=85, value=0)
36
+ ALP = st.number_input('ALP', min_value=0, max_value=420, value=0)
37
+ ALT = st.number_input('ALT', min_value=0, max_value=325, value=0)
38
+ AST = st.number_input('AST', min_value=0, max_value=325, value=0)
39
+ BIL = st.number_input('BIL', min_value=0, max_value=210, value=0)
40
 
41
  st.markdown('---')
42
 
43
+ CHE = st.number_input('CHE', min_value=0, max_value=20, value=0)
44
+ CHOL = st.number_input('CHOL', min_value=0, max_value=10, value=0)
45
+ CREA = st.number_input('CREA', min_value=0, max_value=1080, value=0)
46
+ GGT = st.number_input('GGT', min_value=0, max_value=651, value=0)
47
+ PROT = st.number_input('PROT', min_value=0, max_value=87, value=0)
48
 
49
  submitted = st.form_submit_button('Predict')
50