<jupyter_start><jupyter_text>[View in Colaboratory](https://colab.research.google.com/github/findingfoot/ML_practice-codes/blob/master/Activation_Function.ipynb)<jupyter_code>import warnings
warnings.filterwarnings('ignore')

import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.python.framework import ops
ops.reset_default_graph()

sess = tf.Session()
# intialize the xrange of values

x_val = np.linspace(1.,10.,100)

#Relu

print(sess.run(tf.nn.relu([-5.,5.,10.])))

y_relu = sess.run(tf.nn.relu(x_val))
#Relu6

print(sess.run(tf.nn.relu6([-5.,5.,10.])))

y_relu6 = sess.run(tf.nn.relu6(x_val))
#sigmoid

print(sess.run(tf.nn.sigmoid([-1., 0., 1.])))

y_sigmoid = sess.run(tf.nn.sigmoid(x_val))
#tanh

print(sess.run(tf.nn.tanh([-1., 0., 1.])))

y_tanh = sess.run(tf.nn.tanh(x_val))
print(sess.run(tf.nn.softsign([-1., 0., 1.])))
y_softsign = sess.run(tf.nn.softsign(x_val))
print(sess.run(tf.nn.softplus([-1., 0., 1.])))
y_softplus = sess.run(tf.nn.softplus(x_val))
print(sess.run(tf.nn.elu([-1., 0., 1.])))
y_elu = sess.run(tf.nn.elu(x_val))
plt.plot(x_val, y_softplus, 'r--', label='Softplus', linewidth=2)
plt.plot(x_val, y_relu, 'b:', label='ReLU', linewidth=2)
plt.plot(x_val, y_relu6, 'g-.', label='ReLU6', linewidth=2)
plt.plot(x_val, y_elu, 'k-', label='ExpLU', linewidth=0.5)
plt.ylim([-1.5,7])
plt.legend(loc='upper left')
plt.show()

plt.plot(x_val, y_sigmoid, 'r--', label='Sigmoid', linewidth=2)
plt.plot(x_val, y_tanh, 'b:', label='Tanh', linewidth=2)
plt.plot(x_val, y_softsign, 'g-.', label='Softsign', linewidth=2)
plt.ylim([-2,2])
plt.legend(loc='upper left')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2209512341962673, 'fraction_numerical': 0.028898254063816978, 'mean_word_length': 5.648, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '107715', 'license': 'MIT', 'n_tokens_mistral': 809, 'n_tokens_neox': 763, 'n_words': 109, 'path': 'Activation_Function.ipynb', 'repo_name': 'pk1412/ML_practice-codes', 'size': '1661'}