赞
踩
- %画图
- \usepackage{pgfplots}
- \usepackage{tikz}
- %sigmold
- \begin{tikzpicture}[global scale = 0.5] //[global scale = 0.5]为整体缩放
- \begin{axis}[ //坐标轴属性设置
- axis lines=middle,
- samples=200, //切分格大小
- % grid,
- thick,
- domain=-8:8, //函数范围
- legend pos=outer north east,
- smooth,
- ]
- \addplot+[no marks]{{1/(1+(e^(-1*(\x))))}}; //画函数[]中为属性设置,{}中为函数
- \end{axis}
- \end{tikzpicture}
- \tikzset{global scale/.style={
- scale=#1,
- every node/.append style={scale=#1}
- }
- }
5.1 ReLu
- %ReLu
- \begin{tikzpicture}[global scale = 0.5]
- \begin{axis}[
- axis lines=middle,
- samples=200,
- % grid,
- thick,
- domain=-8:8,
- legend pos=outer north east,
- smooth,
- ]
- \addplot+[no marks]{max(\x,0)};
- \end{axis}
- \end{tikzpicture}
5.2 tanh
- %tanh
- \begin{tikzpicture}[global scale = 0.5]
- \begin{axis}[
- axis lines=middle,
- samples=200,
- % grid,
- thick,
- domain=-8:8,
- legend pos=outer north east,
- smooth,
- ]
- \addplot+[no marks]{((e^(1*(\x)))-(e^(-1*(\x))))/((e^(1*(\x)))+(e^(-1*(\x))))};
- \end{axis}
- \end{tikzpicture}
5.3 SELU
- %SELU
- \begin{tikzpicture}[global scale = 0.5]
- \begin{axis}[
- axis lines=middle,
- samples=200,
- % grid,
- thick,
- domain=-8:8,
- legend pos=outer north east,
- smooth,
- ]
- \addplot[domain=-8:0,blue,thick,] % 设置函数的定义域
- {1*(e^(1*(\x)))-1}; % 输入显式函数
- \addplot[domain=0:8,blue,thick,] % 设置函数的定义域
- {x}; % 输入显式函数
- \end{axis}
- \end{tikzpicture}

5.4 softmax
- %softmax
- \begin{tikzpicture}[global scale = 0.5]
- \begin{axis}[
- axis lines=middle,
- samples=200,
- % grid,
- thick,
- domain=-8:8,
- legend pos=outer north east,
- smooth,
- ]
- \addplot+[no marks]{((e^(0.1*(\x)))-(e^(-1*(\x))))/((e^(0.1*(\x)))+(e^(-1*(\x))))};
- \end{axis}
- \end{tikzpicture}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。