Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. param_candidates = [
  2. {
  3. 'C': [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 3, 5, 10, 20, 30, 100],
  4. 'gamma': [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 3, 5, 10, 20, 30, 100],
  5. 'kernel': ['rbf']
  6. }
  7. ]
  8.  
  9. clf = model_selection.GridSearchCV(
  10. estimator=CustomEstimator(),
  11. param_grid=param_candidates,
  12. cv=5,
  13. refit=True,
  14. error_score=0,
  15. n_jobs=-1
  16. )
  17.  
  18. from sklearn import base
  19. from sklearn import model_selection
  20. from sklearn import ensemble
  21.  
  22. class CustomEstimator(base.BaseEstimator):
  23. def __init__(self):
  24. pass
  25.  
  26. def fit(self, X, y=None, **params):
  27. return self
  28.  
  29. def score(self, X, y=None):
  30. # Here how can i got the param_candidates?
  31. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement