SHARE
TWEET

Untitled

a guest Jan 24th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from xgboost import XGBClassifier
  2. from sklearn.model_selection import train_test_split
  3. from sklearn.metrics import accuracy_score
  4.  
  5. X_train, X_test, y_train, y_test = train_test_split(X, Y, random_state=0)
  6.  
  7. # fit model no training data
  8. model = XGBClassifier()
  9. model.fit(X_train, y_train)
  10.  
  11. # make predictions for test data
  12. y_pred = model.predict(X_test)
  13. predictions = [round(value) for value in y_pred]
  14.  
  15. # evaluate predictions
  16. accuracy = accuracy_score(y_test, predictions)
  17. print("Accuracy: %.2f%%" % (accuracy * 100.0))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top