Created
July 10, 2019 12:04
-
-
Save risenW/5acff911a1c9882f6b2eea2434f60370 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get the data sets | |
X_train, X_val, y_train, y_val = get_split_data(german_cred, target_name='bad_credit') | |
#fit single models | |
log_cf.fit(X_train, y_train) | |
knn_cf.fit(X_train, y_train) | |
svc_cf.fit(X_train, y_train) | |
#make predictions with trained models | |
pred1 = log_cf.predict(X_val) | |
pred2 = knn_cf.predict(X_val) | |
pred3 = svc_cf.predict(X_val) | |
#Take max voting as final prediction | |
maxpred = [] | |
for i in range(0, len(X_val)): | |
#calculate the mode and append to maxpred vector | |
maxpred.append(mode([pred1[i], pred2[i], pred3[i]])) | |
print("Logistic Regression Model") | |
print(get_acc(pred1, y_val)) | |
print("KNN Classifier Model") | |
print(get_acc(pred2, y_val)) | |
print("SVR Classifier Model") | |
print(get_acc(pred3, y_val)) | |
print("Max Voting Model") | |
print(get_acc(np.array(maxpred), y_val)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment