Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,12 @@ 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.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,9 +188,23 @@ if 'Logistic Regression' in selected_models:
|
|
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)
|
@@ -195,6 +212,21 @@ user_input = np.array([age, bp, sg, al, sugar, rbc, pc, pcc, bac, bgr, bu, sc,
|
|
195 |
# import dataset
|
196 |
def get_dataset():
|
197 |
data = pd.read_csv('kidney.csv')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
return data
|
199 |
|
200 |
def generate_model_labels(model_names):
|
|
|
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 |
+
from lightgbm import LGBMClassifier
|
15 |
from sklearn.model_selection import train_test_split
|
16 |
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
|
17 |
|
|
|
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)
|
|
|
212 |
# import dataset
|
213 |
def get_dataset():
|
214 |
data = pd.read_csv('kidney.csv')
|
215 |
+
|
216 |
+
# Calculate the correlation matrix
|
217 |
+
# corr_matrix = data.corr()
|
218 |
+
|
219 |
+
# Create a heatmap of the correlation matrix
|
220 |
+
# plt.figure(figsize=(10, 8))
|
221 |
+
# sns.heatmap(corr_matrix, annot=True, cmap='coolwarm')
|
222 |
+
# plt.title('Correlation Matrix')
|
223 |
+
# plt.xticks(rotation=45)
|
224 |
+
# plt.yticks(rotation=0)
|
225 |
+
# plt.tight_layout()
|
226 |
+
|
227 |
+
# Display the heatmap in Streamlit
|
228 |
+
# st.pyplot()
|
229 |
+
|
230 |
return data
|
231 |
|
232 |
def generate_model_labels(model_names):
|