daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 48 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. # some init code omitted
  2. X_train, X_test, y_train, y_test = train_test_split(X, y)
  3.    
  4. tuned_params = [{'solver': ['sgd'], 'learning_rate': ['constant'], "learning_rate_init" : [0.001, 0.01, 0.05, 0.1]},
  5.                 {"learning_rate_init" : [0.001, 0.01, 0.05, 0.1]}]
  6.    
  7. cv_method = KFold(n_splits=4, shuffle=True)
  8. model = MLPClassifier()
  9.    
  10. grid = GridSearchCV(estimator=model, param_grid=tuned_params, cv=cv_method, scoring='accuracy')
  11. grid.fit(X_train, y_train)
  12. y_pred = grid.predict(X_test)
  13.    
  14. print(grid.best_score_)
  15. print(accuracy_score(y_test, y_pred))
  16.    
  17. A dict with keys as column headers and values as columns,
  18. that can be imported into a pandas DataFrame
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