TypeError grid seach

不羁的心 提交于 2019-12-02 04:27:13

You are supplying 'all' as a param in SelectKBest. But according to the documentation, if you want to pass 'all', you need to specify it as:

SelectKBest(k='all')

The reason is that its a keyword argument, it should be specified with the keyword. Because the first argument to SelectKBest is a positional argument for the scoring function. So when you do not specify the param, 'all' is considered an input for the function and hence the error.

Update:

Now about the shape, the original X will not be changed. So it will print (150,4). The data will be changed on the fly and on my pc the best_param_ is n_components=1, so final shape that goes to svm is (150, 5), 1 from PCA and 4 from SelectKBest.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!