-
Notifications
You must be signed in to change notification settings - Fork 1
/
threshold.py
64 lines (45 loc) · 875 Bytes
/
threshold.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import numpy as np
import matplotlib.pyplot as plt
plt.figure(1)
#linear
plt.subplot(2,2,1)
x = np.array([1,2,3,4,5])
m = 2
c = 3
y = m*x + c
plt.plot(x,y)
plt.title("linear fuction")
plt.xlabel("x")
plt.ylabel("y")
#plt.show()
#sigmoidal
plt.subplot(2,2,2)
x = np.linspace(-10,10,30)
a = np.random.random()
y = 1/(1+np.exp(-a*x))
plt.plot(x,y)
#plt.show()
#signam
plt.subplot(2,2,3)
x = np.linspace(-10,10,30)
y = 1*(x>0)
plt.plot(x,y)
#plt.show()
#relu
plt.subplot(2,2,4)
x = np.linspace(-10,10,100)
y = x*(x>0)
plt.plot(x,y)
plt.show()
#log
x = np.linspace(1,50,100)
y = np.log(x)
plt.plot(x,y)
plt.show()
#exponential
x = np.linspace(-10,10,100)
y = np.exp(x)
plt.plot(x,y)
plt.show()
def ReLu(inp): #note this another way of writing relu function
return(max(0,inp))