我想用rdkit实现来计算ROC曲线:
Rdkit.ML.Scoring.Scoring.CalcAUC(分数,列)
确定ROC曲线下的区域
代码:
import rdkit.ML.Scoring.Scoring
rdkit.ML.Scoring.Scoring.CalcAUC(scores, y)
我得到了以下错误:
IndexError: invalid index to scalar variable.
我的数据:
scores
array([32.336, 31.894, 31.74 , ..., -0.985, -1.629, -1.82 ])
y
array(['Inactive', 'Inactive', 'Inactive', ..., 'Inactive', 'Inactive','Inactive'], dtype=object)
我不知道出了什么问题。
发布于 2020-12-08 19:43:44
from rdkit.ML.Scoring.Scoring import CalcAUC
scores = [32.336, 31.894, 31.74, 30., 20.] # assume scores is sorted in descending order
y = ['Inactive', 'Inactive', 'Inactive', 'Active', 'Inactive']
label_map = {'Active': 1, 'Inactive': 0}
labels = [label_map[y_true] for y_true in y]
auc = CalcAUC(list(zip(scores, labels)), 1)
print('Area Under the ROC Curve:', auc)正如上面的评论中所提到的。关于CalcAUC和其他指标的文档是here,但非常简短。
https://stackoverflow.com/questions/65013696
复制相似问题