can't install specific old version of sklearn to解决pyadio分析库中不兼容的“SVC属性错误”
Posted
技术标签:
【中文标题】can\'t install specific old version of sklearn to解决pyadio分析库中不兼容的“SVC属性错误”【英文标题】:can't install specific older version of sklearn to solve the incompatible "SVC attribute error" in pyadio analysis libcan't install specific old version of sklearn to解决pyadio分析库中不兼容的“SVC属性错误” 【发布时间】:2020-05-01 20:17:04 【问题描述】:以下代码用于音频文件分割。
from pyAudioAnalysis import audiosegmentation as aS
[flagsInd, classesAll, acc, CM] = aS.mtFileClassification("diarizationExample.wav", "svmSM", "svm", True, 'dar.segments.txt')
它给了我这个警告:
C:\Users\Kenzhegaliyev_EK\AppData\Local\Continuum\anaconda3\lib\site-packages\pydub\utils.py:165: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
C:\Users\Kenzhegaliyev_EK\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\utils\deprecation.py:144: FutureWarning: The sklearn.svm.classes module is deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.svm. Anything that cannot be imported from sklearn.svm is now part of the private API.
warnings.warn(message, FutureWarning)
C:\Users\Kenzhegaliyev_EK\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\base.py:318: UserWarning: Trying to unpickle estimator SVC from version 0.19.1 when using version 0.22.1. This might lead to breaking code or invalid results. Use at your own risk.
UserWarning)
这个错误:
C:\Users\Kenzhegaliyev_EK\AppData\Local\Continuum\anaconda3\lib\site-packages\sklearn\svm\_base.py in predict(self, X)
583 """
584 check_is_fitted(self)
--> 585 if self.break_ties and self.decision_function_shape == 'ovo':
586 raise ValueError("break_ties must be False when "
587 "decision_function_shape is 'ovo'")
AttributeError: 'SVC' object has no attribute 'break_ties'
显然,这是 sklearn 中新旧版本的 SVC 之间的冲突。
在警告中它告诉我应该使用 sklearn version = 0.19.1
我尝试安装当前的并升级到 older sklearn。我不能使用shell,它受到限制,所以我在jupyter中运行所有代码:
!pip install sklearn
Installing collected packages: sklearn
Successfully installed sklearn-0.0
import sklearn
sklearn.__version__
'0.22.1'
!pip install --upgrade sklearn==0.19.1
ERROR: Could not find a version that satisfies the requirement sklearn==0.19.1 (from versions: 0.0)
ERROR: No matching distribution found for sklearn==0.19.1
官方sklearn website上没有0.19.1版本:
以下版本提供了基于 Web 的文档:
Scikit-learn 0.23.dev0 (dev) 文档 (PDF 48.5 MB)
Scikit-learn 0.22.1(稳定版)文档(PDF 48.5 MB)
Scikit-learn 0.21.3 文档 (PDF 46.7 MB)
Scikit-learn 0.20.4 文档 (PDF 45.2 MB)
Scikit-learn 0.19.2 文档 (PDF 42.2 MB)
Scikit-learn 0.18.2 文档 (PDF 46.5 MB)
Scikit-learn 0.17.1 文档 (PDF 46.0 MB)
Scikit-learn 0.16.1 文档 (PDF 56.8 MB)
我尝试安装任何其他旧的 sklearn,有什么可用的:
!pip install --upgrade sklearn==0.18.2
ERROR: Could not find a version that satisfies the requirement sklearn==0.18.2 (from versions: 0.0)
ERROR: No matching distribution found for sklearn==0.18.2
!pip install --upgrade sklearn==0.19.2
ERROR: Could not find a version that satisfies the requirement sklearn==0.19.2 (from versions: 0.0)
ERROR: No matching distribution found for sklearn==0.19.2
如何安装正确的旧 sklearn 以使用旧的兼容 SVC 来消除错误?
【问题讨论】:
【参考方案1】:sklearn 的版本很少。这是因为the correct name 是scikit-learn
:https://pypi.org/project/scikit-learn/#history
所以跑
!pip install --upgrade scikit-learn==0.19.1
【讨论】:
谢谢你,但为什么我不能导入 scikit-learn?我做“导入sklearn” 我的意思是如果它不能导入scikit-learn,为什么它可以升级,降级名称“scikiet-learn”?以上是关于can't install specific old version of sklearn to解决pyadio分析库中不兼容的“SVC属性错误”的主要内容,如果未能解决你的问题,请参考以下文章
Play store error: can't install app再试一次,还是不行,看看常见的解决方法
DBD-mysql 已安装,但仍然出现错误“install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC”
sh install-specific-version-of-bosh-init.sh
npm install specific version 不安装特定版本
在 pod install 上创建新的 Cocoapod `Unable to find a specification`