-
-
Save amankharwal/122014b282e589c26ba034d7da3c47a1 to your computer and use it in GitHub Desktop.
This file contains 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
# Logistic Regression | |
from sklearn.linear_model import LogisticRegression | |
params_lr = {'penalty': 'l1', 'solver':'liblinear'} | |
model_lr = LogisticRegression(**params_lr) | |
model_lr, accuracy_lr, roc_auc_lr, coh_kap_lr, tt_lr = run_model(model_lr, X_train, y_train, X_test, y_test) | |
# Decision Tree | |
from sklearn.tree import DecisionTreeClassifier | |
params_dt = {'max_depth': 16, | |
'max_features': "sqrt"} | |
model_dt = DecisionTreeClassifier(**params_dt) | |
model_dt, accuracy_dt, roc_auc_dt, coh_kap_dt, tt_dt = run_model(model_dt, X_train, y_train, X_test, y_test) | |
# Neural Network | |
from sklearn.neural_network import MLPClassifier | |
params_nn = {'hidden_layer_sizes': (30,30,30), | |
'activation': 'logistic', | |
'solver': 'lbfgs', | |
'max_iter': 500} | |
model_nn = MLPClassifier(**params_nn) | |
model_nn, accuracy_nn, roc_auc_nn, coh_kap_nn, tt_nn = run_model(model_nn, X_train, y_train, X_test, y_test) | |
# Random Forest | |
from sklearn.ensemble import RandomForestClassifier | |
params_rf = {'max_depth': 16, | |
'min_samples_leaf': 1, | |
'min_samples_split': 2, | |
'n_estimators': 100, | |
'random_state': 12345} | |
model_rf = RandomForestClassifier(**params_rf) | |
model_rf, accuracy_rf, roc_auc_rf, coh_kap_rf, tt_rf = run_model(model_rf, X_train, y_train, X_test, y_test) | |
# Light GBM | |
import lightgbm as lgb | |
params_lgb ={'colsample_bytree': 0.95, | |
'max_depth': 16, | |
'min_split_gain': 0.1, | |
'n_estimators': 200, | |
'num_leaves': 50, | |
'reg_alpha': 1.2, | |
'reg_lambda': 1.2, | |
'subsample': 0.95, | |
'subsample_freq': 20} | |
model_lgb = lgb.LGBMClassifier(**params_lgb) | |
model_lgb, accuracy_lgb, roc_auc_lgb, coh_kap_lgb, tt_lgb = run_model(model_lgb, X_train, y_train, X_test, y_test) | |
# Catboost | |
!pip install catboost | |
import catboost as cb | |
params_cb ={'iterations': 50, | |
'max_depth': 16} | |
model_cb = cb.CatBoostClassifier(**params_cb) | |
model_cb, accuracy_cb, roc_auc_cb, coh_kap_cb, tt_cb = run_model(model_cb, X_train, y_train, X_test, y_test, verbose=False) | |
# XGBoost | |
import xgboost as xgb | |
params_xgb ={'n_estimators': 500, | |
'max_depth': 16} | |
model_xgb = xgb.XGBClassifier(**params_xgb) | |
model_xgb, accuracy_xgb, roc_auc_xgb, coh_kap_xgb, tt_xgb = run_model(model_xgb, X_train, y_train, X_test, y_test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment