上面的代码显示__init__() got an unexpected keyword argument 'solver',是版本问题吗〉
时间: 2023-11-19 20:34:00 浏览: 12
是的,这个错误通常是因为版本不兼容导致的。在Scikit-learn 0.20版本之前,没有'solver'参数。如果你使用了早期版本的Scikit-learn,那么需要将'solver'参数从代码中删除。如果你使用的是Scikit-learn 0.20或更高版本,那么可能是因为你的代码中有某些参数被错误地设置了。你可以检查一下代码中的参数设置是否正确,并且和Scikit-learn的文档进行对比。
相关问题
上面代码报错__init__() got an unexpected keyword argument 'width'
这个错误通常是因为你在实例化一个类时,传递了一个该类不支持的参数。可能原因是你传递了一个名为"width"的参数,但是该类的构造函数没有定义该参数。你可以检查一下你调用类时传递的参数是否正确,或者检查一下类的定义,看一下构造函数中是否定义了"width"参数。如果没有定义,你可以考虑删除该参数或者将其改为该类支持的参数。
__init__() got an unexpected keyword argument
__init__()方法是Python中的一个特殊方法,用于初始化对象的属性。当在创建对象时,传递给__init__()方法的参数与定义的参数不匹配时,就会出现"__init__() got an unexpected keyword argument"的错误。
这个错误通常发生在以下情况下:
1. 定义了一个类,并在__init__()方法中定义了一些参数,但在创建对象时传递了不匹配的参数。
2. 在子类中重写了父类的__init__()方法,并且子类的参数与父类的参数不匹配。
解决这个问题的方法是检查传递给__init__()方法的参数是否与定义的参数一致。确保参数名称和数量都正确,并且没有多余的参数。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)