计算和可视化ROC曲线的工具。
roc-utils的Python项目详细描述
roc实用工具
这个Python包提供了计算和可视化ROC curves的工具,这些工具用于以图形方式评估二进制分类器的诊断能力。在
使用^{
安装:
pip install roc-utils
使用以下命令快速验证安装。在
^{pr2}$用法:
请参见examples/tutorial.ipynb了解逐步介绍。在
importnumpyasnpimportmatplotlib.pyplotaspltimportroc_utilsasru# Construct a binary classification problemx,y=ru.demo_sample_data(n1=300,mu1=0.0,std1=0.5,n2=300,mu2=1.0,std2=0.7)# Compute the ROC curve...pos_label=Trueroc=ru.compute_roc(X=x,y=y,pos_label=pos_label)# ...and visualize itru.plot_roc(roc,label="Sample data",color="red")plt.show()# To perform a ROC analysis using bootstrappingn_samples=20ru.plot_roc_bootstrap(X=x,y=y,pos_label=pos_label,n_bootstrap=n_samples,title="Bootstrap demo");plt.show()
从源代码生成:
获取或运行项目的示例:
git clone https://github.com/hirsch-lab/roc-utils.git
cd roc-utils
python tests/test_all.py
python examples/examples.py
要创建分发包(源归档文件和控制盘):
python setup.py sdist bdist_wheel
要从源归档文件安装新创建的Python包,请执行以下操作:
pip uninstall roc-utils pip cache remove roc_utils pip install dist/roc_utils*.tar.gz # Verify installation python -c "import roc_utils; print(roc_utils.__version__)" python -c "import roc_utils; roc_utils.demo_bootstrap()"
- 项目
标签: