ERJAN
ERJAN

Reputation: 24508

can't install specific older version of sklearn to solve the incompatible "SVC attribute error" in pyadio analysis lib

This code below is for audio file segmentation.

from pyAudioAnalysis import audioSegmentation as aS
[flagsInd, classesAll, acc, CM] = aS.mtFileClassification("diarizationExample.wav", "svmSM", "svm", True, 'dar.segments.txt')

it gives me this warning:

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)

and this error:

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'

apparently, it's a conflict between older & newer versions of SVC in sklearn.

In the warning it tells i should probably use sklearn version = 0.19.1

I tried installing the current and upgrading to older sklearn. I can't use shell, it's restricted, so i run all code in 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

there is no version 0.19.1 on the official sklearn website:

Web-based documentation is available for versions listed below:

Scikit-learn 0.23.dev0 (dev) documentation (PDF 48.5 MB)

Scikit-learn 0.22.1 (stable) documentation (PDF 48.5 MB)

Scikit-learn 0.21.3 documentation (PDF 46.7 MB)

Scikit-learn 0.20.4 documentation (PDF 45.2 MB)

Scikit-learn 0.19.2 documentation (PDF 42.2 MB)

Scikit-learn 0.18.2 documentation (PDF 46.5 MB)

Scikit-learn 0.17.1 documentation (PDF 46.0 MB)

Scikit-learn 0.16.1 documentation (PDF 56.8 MB)

I tried installing any other old sklearn, what is available:

!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

How to install the right older sklearn to use the older compatible SVC to make the error go away?

Upvotes: 0

Views: 3861

Answers (1)

phd
phd

Reputation: 94963

There are very few releases of sklearn. This because the correct name is scikit-learn: https://pypi.org/project/scikit-learn/#history

So run

!pip install --upgrade scikit-learn==0.19.1

Upvotes: 2

Related Questions