SHARE
TWEET

Untitled

a guest Jun 20th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. X = df.drop(['label'], axis=1)
  2. y = df['label']
  3. training_count = 0
  4.  
  5. X_train, test_data, y_train, test_label = train_test_split(X, y, test_size=0.1, random_state=7)
  6. model = XGBClassifier(learning_rate=0.5, n_estimators=250, max_depth= 5)
  7. model.fit(X_train, y_train)
  8. model.save_model('trained_model_full')
  9.  
  10. #validation
  11. from collections import  OrderedDict
  12. from operator import itemgetter
  13. import csv
  14.  
  15.  
  16. model = XGBClassifier()
  17. booster = xgb.Booster()
  18. booster.load_model('trained_model_full')
  19. model._Booster = booster
  20. model._le = LabelEncoder().fit(test_label)
  21. start = time.time()
  22. pred = model.predict(test_data)
  23. end = time.time()
  24.      
  25. X = df.drop(['label'], axis=1)
  26. y = df['label']
  27. training_count = 0
  28.  
  29. X_train, test_data, y_train, test_label = train_test_split(X, y, test_size=0.1, random_state=7)
  30.  
  31. #validation
  32. from collections import  OrderedDict
  33. from operator import itemgetter
  34. import csv
  35.  
  36.  
  37. model = XGBClassifier()
  38. booster = xgb.Booster()
  39. booster.load_model('trained_model_full')
  40. model._Booster = booster
  41. model._le = LabelEncoder().fit(test_label)
  42. start = time.time()
  43. pred = model.predict(test_data)
  44. end = time.time()
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