Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,12 +6,9 @@ import matplotlib.pyplot as plt
|
|
6 |
from sklearn.ensemble import RandomForestClassifier, VotingClassifier
|
7 |
from sklearn.tree import DecisionTreeClassifier
|
8 |
from sklearn.linear_model import LogisticRegression
|
9 |
-
from sklearn.svm import SVC
|
10 |
from sklearn.naive_bayes import GaussianNB
|
11 |
-
from sklearn.neural_network import MLPClassifier
|
12 |
-
from sklearn.ensemble import GradientBoostingClassifier
|
13 |
from xgboost import XGBClassifier
|
14 |
-
|
15 |
from sklearn.model_selection import train_test_split
|
16 |
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
|
17 |
|
@@ -188,23 +185,9 @@ if 'Logistic Regression' in selected_models:
|
|
188 |
if 'Decision Tree' in selected_models:
|
189 |
models_to_run.append(DecisionTreeClassifier())
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
if 'Support Vector Machine' in selected_models:
|
194 |
-
models_to_run.append(SVC())
|
195 |
-
|
196 |
-
if 'LightGBM' in selected_models:
|
197 |
-
models_to_run.append(LGBMClassifier())
|
198 |
-
|
199 |
if 'XGBoost' in selected_models:
|
200 |
models_to_run.append(XGBClassifier())
|
201 |
|
202 |
-
if 'Multilayer Perceptron' in selected_models:
|
203 |
-
models_to_run.append(MLPClassifier())
|
204 |
-
|
205 |
-
if 'Artificial Neural Network' in selected_models:
|
206 |
-
models_to_run.append(MLPClassifier(hidden_layer_sizes=(100,), max_iter=100))
|
207 |
-
|
208 |
|
209 |
user_input = np.array([age, bp, sg, al, sugar, rbc, pc, pcc, bac, bgr, bu, sc,
|
210 |
sod, pot, hemo, pcv, wbc, rbcc, htn, dm, cad, appet, pe, ane]).reshape(1, -1)
|
@@ -217,15 +200,15 @@ def get_dataset():
|
|
217 |
# corr_matrix = data.corr()
|
218 |
|
219 |
# Create a heatmap of the correlation matrix
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
|
227 |
# Display the heatmap in Streamlit
|
228 |
-
|
229 |
|
230 |
return data
|
231 |
|
|
|
6 |
from sklearn.ensemble import RandomForestClassifier, VotingClassifier
|
7 |
from sklearn.tree import DecisionTreeClassifier
|
8 |
from sklearn.linear_model import LogisticRegression
|
|
|
9 |
from sklearn.naive_bayes import GaussianNB
|
|
|
|
|
10 |
from xgboost import XGBClassifier
|
11 |
+
|
12 |
from sklearn.model_selection import train_test_split
|
13 |
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
|
14 |
|
|
|
185 |
if 'Decision Tree' in selected_models:
|
186 |
models_to_run.append(DecisionTreeClassifier())
|
187 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
if 'XGBoost' in selected_models:
|
189 |
models_to_run.append(XGBClassifier())
|
190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
user_input = np.array([age, bp, sg, al, sugar, rbc, pc, pcc, bac, bgr, bu, sc,
|
193 |
sod, pot, hemo, pcv, wbc, rbcc, htn, dm, cad, appet, pe, ane]).reshape(1, -1)
|
|
|
200 |
# corr_matrix = data.corr()
|
201 |
|
202 |
# Create a heatmap of the correlation matrix
|
203 |
+
plt.figure(figsize=(10, 8))
|
204 |
+
sns.heatmap(corr_matrix, annot=True, cmap='coolwarm')
|
205 |
+
plt.title('Correlation Matrix')
|
206 |
+
plt.xticks(rotation=45)
|
207 |
+
plt.yticks(rotation=0)
|
208 |
+
plt.tight_layout()
|
209 |
|
210 |
# Display the heatmap in Streamlit
|
211 |
+
st.pyplot()
|
212 |
|
213 |
return data
|
214 |
|