-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSigmoid.py
More file actions
41 lines (29 loc) · 708 Bytes
/
Sigmoid.py
File metadata and controls
41 lines (29 loc) · 708 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
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import numpy as np
import matplotlib.pyplot as plt
# 1(a) Sigmoid
def sigmoid(x):
s = 1/(1+np.exp(-x))
plt.plot(x,s)
plt.xlabel('valus of x')
plt.ylabel('sigmoid Values')
plt.title('Sigmoid Function')
plt.legend(["Sigmoid"])
plt.show()
return s
def Sigmoid_Derivative(x):
s = 1/(1+np.exp(-x))
sd = s*(1-s)
plt.plot(x,sd)
plt.xlabel('valus of x')
plt.ylabel('sigmoid_Derivative Values')
plt.title('Sigmoid_Derivative Function')
plt.legend(["SigmoidDerivativs"])
plt.show()
return sd
x = np.array(np.arange(-10,11,1))
s = print(sigmoid(x))
sd = print(Sigmoid_Derivative(x))
# In[ ]: