Advertisement
Guest User

Untitled

a guest
May 27th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. from sklearn.neighbors import KNeighborsClassifier
  2.  
  3. def KBest_LDA_KNB(k, n, p):
  4. tuned_parameters = [
  5. { 'feature_selection' : [SelectKBest()],
  6. 'feature_selection__k' : k,
  7. 'feature_reduction' : [LinearDiscriminantAnalysis()],
  8. 'feature_reduction__n_components' : n,
  9. 'clf__n_neighbors' : p
  10. },
  11. ]
  12. estimators = [('feature_selection', SelectKBest()), ('feature_reduction', LinearDiscriminantAnalysis()) ,('clf', KNeighborsClassifier(n))]
  13. return (estimators, tuned_parameters)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement