Skip to content

Instantly share code, notes, and snippets.

@fuwiak
Last active August 13, 2019 17:16
Show Gist options
  • Save fuwiak/0e6f511eb3419640e7f3205ca6d22913 to your computer and use it in GitHub Desktop.
Save fuwiak/0e6f511eb3419640e7f3205ca6d22913 to your computer and use it in GitHub Desktop.
from sklearn.model_selection import train_test_split
from xboost import XGBClassifier
X = #yours data
y = #labels
train_X, test_X, train_y, test_y = train_test_split(X, y, test_size=0.3, random_state=100)
parameters = {'nthread':[6],
'objective':['binary:logistic'],
'learning_rate': [0.01, 0.1],
'max_depth': [5,8,13],
'n_estimators': [200,500,1000,3000],
'seed': [1337]}
clf = XGBClassifier(param_grid=parameters)
clf.fit(X_train, y_train)
predictions = clf.predict(test_X)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment