DeepLearning 知识点整理

常用激活函数

import theano
from keras import backend as K
import keras.activations as A

#
from pylab import *
x = theano.tensor.dmatrix()
softmax = theano.function([x], A.softmax(x))
softplus = theano.function([x], A.softplus(x))
relu = theano.function([x], A.relu(x))
tanh = theano.function([x], A.tanh(x))
sigmoid = theano.function([x], A.sigmoid(x))
hard_sigmoid = theano.function([x], A.hard_sigmoid(x))
linear = theano.function([x], A.linear(x))
xv = np.array([range(-20, 20)])
for i, fn in enumerate(["softmax", "softplus", "relu", "tanh", "sigmoid", "hard_sigmoid", "linear"]):
    plt.subplot(3, 3, i + 1)
    plt.title(fn)
    plt.plot(xv[0], eval(fn)(xv)[0])

plt.show()

DeepLearning 知识点整理_第1张图片

你可能感兴趣的:(Deep,Learning,dnn)