如何使用Julia画AUC曲线

julia
Published

July 8, 2022

AUC(area under the curve)是一个用于模型评估的工具,也就是ROC曲线下的面积大小。

安装方法:

] add https://github.com/diegozea/ROC.jl

using AUC
LoadError: ArgumentError: Package AUC not found in current path.
- Run `import Pkg; Pkg.add("AUC")` to install the AUC package.
function noisy(label; λ=0.0)
           if label
               return 1 - λ*rand()
           else
               return λ*rand()
           end
       end
noisy (generic function with 1 method)
labels = rand(Bool, 200);
scores(λ) = map(labels) do label
           noisy(label, λ=λ)
       end
scores (generic function with 1 method)
roc_good = roc(scores(0.6), labels, true);
roc_bad = roc(scores(1.0), labels, true);
LoadError: UndefVarError: roc not defined