-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslp
More file actions
24 lines (18 loc) · 628 Bytes
/
Copy pathslp
File metadata and controls
24 lines (18 loc) · 628 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
X_train = df_enc.drop("Heart_Disease", axis = 1)
y_train = df_enc["Heart_Disease"]
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_train, X_test, y_train, y_test = train_test_split(X_train, y_train, test_size = 0.2, random_state = 42)
model = MLPClassifier(
hidden_layer_sizes = (1,),
max_iter = 1000,
random_state = 42
)
model.fit(X_train, y_train)
results = model.predict(X_test)
print("SLP Accuracy:", accuracy_score(y_test, results))
print(classification_report(y_test, results))
plt.plot(model.loss_curve_)
plt.title("SLP Loss Curve - CVD")
plt.xlabel("Iterations")
plt.ylabel("Loss")