Activation Function

20 November 2011
Write a MATLAB program to generate a few activation functions that are being used in neural networks. The activation functions play a major role in determining the output of the functions. One such program for generating the activation functions is as given below.

example21.m

%Illustration of various activation function used in NN's
x = -10:0.1:10;
tmp = exp(-x);
y1 = 1 ./ (1 + tmp);
y2 = (1 - tmp) ./ (1 + tmp);
y3 = x;
subplot(231); plot(x, y1); grid on;
axis([min(x) max(x) -2 2]);
title('Logistic Function');
xlabel('(a)');
axis('square');
subplot(232); plot(x, y2); grid on;
axis([min(x) max(x) -2 2]);
title('Hyperbolic Tangent Function');
xlabel('(b)');
axis('square');
subplot(233); plot(x, y3); grid on;
axis([min(x) max(x) min(x) max(x)]);
title('Identity Function');
xlabel('(c)');
axis('square');

0 comments:

Catat Ulasan

Terima kasih kerana memberi ulasan...