-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSoftsign.py
More file actions
45 lines (28 loc) · 699 Bytes
/
Softsign.py
File metadata and controls
45 lines (28 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import numpy as np
import matplotlib.pyplot as plt
def SoftSign(x):
s = x/(1+abs(x))
plt.plot(x,s)
plt.xlabel('valus of x')
plt.ylabel('SoftSign Values')
plt.title('SoftSign Function')
plt.legend(["Softsign"])
plt.show()
return s
def SoftSign_Derivative(x):
sd = 1/(1+(abs(x))**2)
plt.plot(x,sd)
plt.xlabel('valus of x')
plt.ylabel('SoftSign_Derivative Values')
plt.title('SoftSign_Derivative Function')
plt.legend(["Softsign Derivative"])
plt.show()
return sd
x = np.array(np.arange(-10,11,1))
s = print(SoftSign(x))
sd = print(SoftSign_Derivative(x))
# In[ ]:
# In[ ]: