小编And*_*kis的帖子

分类报告 - 精度和 F 分数不明确

我从 sklearn.metrics 导入了分类报告,当我输入我的np.arraysas 参数时,出现以下错误:

/usr/local/lib/python3.6/dist-packages/sklearn/metrics/classification.py:1135: UndefinedMetricWarning: Precision 和 F-score 定义不明确,在没有预测样本的标签中设置为 0.0。'precision', 'predicted', average, warn_for) /usr/local/lib/python3.6/dist-packages/sklearn/metrics/classification.py:1137: UndefinedMetricWarning: Recall 和 F-score 定义不明确,正在在没有真实样本的标签中设置为 0.0。'召回'、'真'、平均值、warn_for)

这是代码:

svclassifier_polynomial = SVC(kernel = 'poly', degree = 7, C = 5)

svclassifier_polynomial.fit(X_train, y_train)
y_pred = svclassifier_polynomial.predict(X_test)


poly = classification_report(y_test, y_pred)
Run Code Online (Sandbox Code Playgroud)

当我过去不使用 np.array 时,它工作得很好,关于如何纠正这个问题的任何想法?

python classification machine-learning scikit-learn

7
推荐指数
1
解决办法
1万
查看次数

无法在 Google Colab 中导入声音设备

我正在尝试使用以下代码在 Google Colab 中导入声音设备库:

pip install sounddevice
import sounddevice as sd
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误。

---------------------------------------------------------------------------

    OSError                                   Traceback (most recent call last)
    
    <ipython-input-8-fba28aeb5c71> in <module>()
          7 import numpy as np
          8 import requests
    ----> 9 import sounddevice as sd
         10 import tensorflow as tf
         11 import keras
    
    /usr/local/lib/python3.6/dist-packages/sounddevice.py in <module>()
         69             break
         70     else:
    ---> 71         raise OSError('PortAudio library not found')
         72     _lib = _ffi.dlopen(_libname)
         73 except OSError:
    
    OSError: PortAudio library not found
Run Code Online (Sandbox Code Playgroud)

有没有办法在 Colab 中使用该库?

python python-sounddevice google-colaboratory

3
推荐指数
1
解决办法
6344
查看次数