Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/roc_auc.py Secret

Created Apr 7, 2021
Embed
What would you like to do?
target = train.pop('target')
for i in train.columns:
if train[i].dtype == 'object':
label = LabelEncoder()
label.fit(list(train[i].values)+list(test[i].values))
train[i] = label.transform(train[i].values)
test[i] = label.transform(test[i].values)
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(train, target, test_size=0.1, random_state=0)
from lightgbm import LGBMClassifier
model = LGBMClassifier(random_state=0, metric='auc')
model.fit(x_train, y_train)
y_pred = model.predict_proba(x_test)[:, 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment