gridsearchcv花费太多时间并抛出随机错误?

2024-09-30 08:37:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经为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之后,我没有发现任何帮助。在

请帮忙。在


Tags: 数据test网格dataistransformtrainerror

热门问题