很长一段时间以来,我一直在努力使用 Gridsearchcv。
在对我的火车数据进行矢量化后,我使用网格搜索来进行有效的参数设置,但我得到了连续的错误。
我的代码是这样的:
x = HashVectorizer().fit_transform( train_data.data )
parameters = { "c" : [0.001 , 0.01 , 0.1 , 1 , 10 , 100 , 1000]}
if __name__ == "__main__":# i recetly fixed this error
clf = GridSearchCV(LogisticRegression() , parameters , n_jobs = -1 , verbose = 1)
train = clf.fit( x , x.label)
y = HashVectorizer().transform( test_data.data )
test = clf.predict(y)# here is my PROBLEM line , the error is coming as "clf is not defined "
但是我已经定义了clf
,在检查gridsearchcv 文档之后我也没有发现任何帮助。
请帮忙。