用于检索假负值的 Python 编程

标签 python numpy

如何使用 python 检索从混淆矩阵中获取的假阴性值:

Tn:27, FP=0, FN=7, TP=6

任何帮助将不胜感激:

idx = X[np.where(y_test != y_pred)[0]].sum(axis=1)

np.array(corpus)[idx] # I have tried this I could not able to get those.

idx=X[np.where(y_test != y_pred)[0]].sum(axis=1)
np.array(corpus)[idx]

Tp-6 TN-27 FP=0 FN=7 

我想检索假阴性值。我从上面的代码中获取了所有误报和误报值,但我试图仅检索误报值。

最佳答案

您可以使用 bool 索引来获取假负值


## get boolean indexes for false negetive 
fn_ind = (y_pred==False) & (y_pred != y_test)
fn_rows = X[fn_ind]

关于用于检索假负值的 Python 编程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58054941/

相关文章:

Python:numpy/pandas 根据条件更改值

Python Pandas 如何找到同时出现的顶级字符串?

python - 将行中的值分组在一起并为其分配一个整数值

Python:字典值中的八进制转义字符\033 在打印语句中转换为 UTF-8 字符

python - netCDF 转换为 NaN 以用于条件

python - 为什么用 OpenCV 保存图像会产生黑色图像?

Python:替换 NaN 或 MEAN 而不是数组中的 -999 值

python-2.7 - python解释器中的无限循环

Python-如何在 x 和 y 之间做一个 if 语句?

python - 使用opencv识别OCR期间的元音字符