__init__() got an unexpected keyword argument 'n_jobs' 报错怎么办
时间: 2023-10-03 15:04:25 浏览: 67
这个错误通常是因为你使用的函数或类没有 `n_jobs` 参数,或者你传递给它的参数名不是 `n_jobs`。
如果你使用的是某个库中的函数或类,可以查看官方文档或源代码,确认该函数或类是否支持 `n_jobs` 参数。
如果你自己编写的代码中出现了这个错误,可以检查你是否在函数或类中使用了 `n_jobs` 参数,并且确认参数名是否正确。
另外,有些库在某些版本中可能会取消了 `n_jobs` 参数,你可以考虑升级或降级相应的库。
相关问题
__init__() got an unexpected keyword argument 'n_jobs
This error message is raised when the `__init__()` method of a class is called with an unexpected keyword argument `n_jobs`. This means that the class does not expect to receive the `n_jobs` argument, or it expects it to have a different name.
The `n_jobs` argument is often used in scikit-learn to specify the number of CPU cores to use for parallel processing. If you are encountering this error while using scikit-learn, make sure that you are passing the `n_jobs` argument to a method that expects it, and that you are passing it with the correct name.
If you are encountering this error with your own code, check the documentation or source code of the class you are using to see if it supports the `n_jobs` argument. If it does not, consider using a different class or library that does support parallel processing.
__init__() got an unexpected keyword argument 'n_jobs'
This error message suggests that the function or method you are trying to run does not recognize the parameter `n_jobs`. This parameter is often used to specify the number of parallel jobs to use for computation.
There are a few possible explanations for this error:
1. The code you are running does not support parallel processing and does not have a `n_jobs` parameter. In this case, you would need to modify the code to enable parallel processing or remove the `n_jobs` parameter.
2. The version of the library you are using does not support `n_jobs`. In this case, you may need to update the library to a newer version.
3. There is a typo or other mistake in your code that is causing the error. Double-check your code to make sure that you are passing the `n_jobs` parameter correctly and that it is spelled correctly.
Without more information about the specific code and library you are working with, it is difficult to provide a more specific solution.
阅读全文