我必须交付一个机器学习项目,我收到了一个名为tester.py. 在另一个文件中编写完代码后,我必须运行 tester.py 才能查看结果,但出现错误:TypeError: 'StratifiedShuffleSplit' object is not iterable
我在另一个主题和网站上研究过这个错误,解决方法总是一样的:使用 sklearn.model_selection 导入 GridSearchCV。从一开始我就已经这样做了,但是文件 tester.py 没有运行。
tester.py 中出现问题的代码部分是:
def main():
### load up student's classifier, dataset, and feature_list
clf, dataset, feature_list = load_classifier_and_data()
### Run testing script
test_classifier(clf, dataset, feature_list)
if __name__ == '__main__':
main()
我自己的代码工作正常。
有什么帮助吗?