我已经为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 documentation之后,我没有发现任何帮助。在
请帮忙。在
移动代码并使其与IF语句对齐。因为您是在IF语句下定义clf,而这是它们的本地语句。在
相关问题 更多 >
编程相关推荐