ROC 曲线在 x 轴上具有负值,在 y 轴上具有大于 100% 的值

ROC curve have negative values on the x-axis and greater than 100% on the y-axis

我正在尝试绘制一条带有平滑线的 ROC 曲线(我需要它平滑)。但是线超出了X轴和Y轴

如何修复下一条 latex 指令以正确获取此信息。

\begin{tikzpicture}
\begin{axis}[
    font=\sf,
    xlabel={False Positive Rate},
    ylabel={True Positive Rate},
    xmin= -0.05, xmax=1,
    ymin= 0, ymax=1.1,
    xtick={0,.2,.4,.6,.8,1},
    ytick={0,.2,.4,.6,.8,1},
    legend pos=south east,
    no markers,
    every axis plot/.append style={ultra thick}
]
\addlegendimage{empty legend}
\addlegendentry{\hspace{-.6cm}\textbf{AUC}}

\addplot[smooth ,red ] 
coordinates {(0,0)(0.00635842,0.99631106)(1,1)}; \addlegendentry{L =  \%99.49}
\end{axis}
\end{tikzpicture}

您的第二个点 (0.00635842,0.99631106) 的 y 坐标非常接近 1,因此当您尝试绘制平滑图时,绘图算法无法绘制这样的图形保留在 y=1 行下方。事实上,pgf manual

Note that the smoothing algorithm is not very intelligent. You will get the best results if the bending angles are small, that is, less than about 30◦ and, even more importantly, if the distances between points are about the same all over the plotting path.

在你的例子中,这些点不满足这些要求,它们定义了一个几乎直角。

您可以使用 tension 选项进行一些控制:

\documentclass{standalone}

\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    font=\sf,
    xlabel={False Positive Rate},
    ylabel={True Positive Rate},
    xmin= -0.05, xmax=1,
    ymin= 0, ymax=1.1,
    xtick={0,.2,.4,.6,.8,1},
    ytick={0,.2,.4,.6,.8,1},
    legend pos=south east,
    no markers,
    %every axis plot/.append style={ultra thick}
]
\addlegendimage{empty legend}
\addlegendentry{\hspace{-.6cm}\textbf{AUC}}

\addplot[smooth,red, tension=0.03 ] 
coordinates {(0,0)(0.00635842,0.99631106)(1,1)}; 
\addlegendentry{L =  \%99.49}
%% Just to check how much the red graph goes outside the correct region.
\addplot[black,dashed] coordinates{(0,1) (1,1)};
\addplot[black,dashed] coordinates{(0,0) (0,1)};
\end{axis}
\end{tikzpicture}