在 GridSearchCV 函数中获取 ValueError 和单元格错误以查找最佳模型

问题描述 投票:0回答:0
    ------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[86], line 43
     36         scores.append({
     37             'model': algo_name,
     38             'best_score': gs.best_score_,
     39             'best_params': gs.best_params_
     40         })
     42     return pd.DataFrame(scores,columns=['model','best_score','best_params'])
---> 43 find_best_model_using_gridsearchcv(X, y)

Cell In[86], line 35, in find_best_model_using_gridsearchcv(X, y)
     33 for algo_name, config in algos.items():
     34     gs =  GridSearchCV(config['model'], config['params'], cv=cv, return_train_score=False)
---> 35     gs.fit(X,y)
     36     scores.append({
     37         'model': algo_name,
     38         'best_score': gs.best_score_,
     39         'best_params': gs.best_params_
     40     })
     42 return pd.DataFrame(scores,columns=['model','best_score','best_params'])

找出箭头一中的错误如何解决此问题我没有从我这边得到任何解决方案。 请帮助我,因为我是机器学习领域的初学者。

我尝试了所有算法,但我不明白为什么调用函数和 gs.fit() functn 时出错,我在这个平台上搜索,但没有得到有关此问题的任何答案。

machine-learning jupyter-notebook decision-tree gridsearchcv lasso-regression
© www.soinside.com 2019 - 2024. All rights reserved.