# 8. 분류 모델링
# 8-1. 랜덤포레스트
from sklearn.ensemble import RandomForestClassifier
model1 = RandomForestClassifier(max_depth=10, n_estimators=100)
model1.fit(new_X_train, new_y_train)
print(model1.score(new_X_train, new_y_train))
predict = model1.predict_proba(X_val)
pred = predict[:, 1]
from sklearn.metrics import roc_auc_score
print(roc_auc_score(y_val, pred))
# 8-2. 로지스틱 회귀
from sklearn.linear_model import LogisticRegression
model2 = LogisticRegression()
model2.fit(X_train, y_train['gender'])
print(model1.score(new_X_train, new_y_train))
predict = model2.predict_proba(X_val)
pred = predict[:, 1]
from sklearn.metrics import roc_auc_score
print(roc_auc_score(y_val, pred))
# 8-3.knn
from sklearn.neighbors import KNeighborsClassifier
model3 = KNeighborsClassifier(n_neighbors=4, metric='euclidean')
model3.fit(X_train, y_train['gender'])
print(model1.score(new_X_train, new_y_train))
predict = model3.predict_proba(X_val)
pred = predict[:, 1]
from sklearn.metrics import roc_auc_score
print(roc_auc_score(y_val, pred))
# 8-4. 결정나무
from sklearn.tree import DecisionTreeClassifier
model4 = DecisionTreeClassifier(random_state=1, max_depth=10)
model4.fit(X_train, y_train['gender'])
print(model1.score(new_X_train, new_y_train))
predict = model4.predict_proba(X_val)
pred = predict[:, 1]
from sklearn.metrics import roc_auc_score
print(roc_auc_score(y_val, pred))
# 8-5. SVM
from sklearn.svm import SVC
model5 = SVC(C=10, gamma=1, random_state=1, probability=True)
model5.fit(X_train, y_train['gender'])
print(model1.score(new_X_train, new_y_train))
predict = model5.predict_proba(X_val)
pred = predict[:, 1]
from sklearn.metrics import roc_auc_score
print(roc_auc_score(y_val, pred))
# 8-6. xgboost
import xgboost as xgb
from xgboost.sklearn import XGBClassifier