Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. # Define Search Param
  2. search_params = {
  3. 'n_components': [5, 6, 7, 8]
  4. ‘learning_method’: [‘online’,’batch’],
  5. ‘learning_decay’: [0.5, 0.7, 0.9],
  6. ‘learning_offset’: [1, 5, 10]
  7. }
  8.  
  9. # Init the Model
  10. lda = LDA(random_state = 123)
  11.  
  12. # Init Grid Search Class
  13. model = GridSearchCV(lda, param_grid = search_params)
  14.  
  15. # Do the Grid Search
  16. model.fit(sessions_vectorized)
  17.  
  18. #Pick the best model
  19. best_lda_model = model.best_estimator_
  20. best_lda_model.fit(sessions_vectorized)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement