# -- coding: utf-8 --
import numpy as np
import math
import matplotlib.pyplot as plt
x = np.arange(-10, 10, 0.1)
y = []
title_name='Sigmoid'
for t in x:
if title_name=='Sigmoid':
y_1 = 1 / (1 + math.exp(-t))
if title_name=='ReLU':
if t<0:
y_1=0
else:
y_1=t
y.append(y_1)
plt.title(title_name, fontsize=12)
plt.tick_params(axis='both', which='major', labelsize=8)
plt.plot(x, y, label="sigmoid")
plt.xlabel("x",fontsize=12)
plt.ylabel("f(x)",fontsize=12)
# plt.ylim(0, 1)
# plt.legend()
plt.tight_layout()
plt.savefig('./'+title_name+'.png', pad_inches=0, dpi=600)
plt.show()