Professional Documents
Culture Documents
7.1 Sketching The Responses: (I) N P W 1 0.27 0.48
7.1 Sketching The Responses: (I) N P W 1 0.27 0.48
Πρόβληµα 7
1η Σειρά Προβλιµάτων 39
Κεφάλαιο 7. Πρόβληµα 7
40 1η Σειρά Προβλιµάτων
7.1 Sketching the responses
1η Σειρά Προβλιµάτων 41
Κεφάλαιο 7. Πρόβληµα 7
(vi) α2 = purelin (n 2 )2 = n 2
7 # Problem−07
8 #
9 #
10 # defines l i b r a r i e s and the values o f the parameters
11 #
12
13 import numpy as np
14 import matplotlib . pyplot as p l t
15
16 def sigmoid ( x ) :
17 return 1 / (1 + np . exp( − x ) )
18
19 def purelin ( x ) :
20 return x∗∗0.5
42 1η Σειρά Προβλιµάτων
7.2 Python Code
21
22 def p l o t t ( k ) :
23 p l t . p l o t ( p , k , ’−r ’ )
24 p l t . x l a b e l ( ’ p ’ , c o l o r = ’ #1C2833 ’ )
25 p l t . y l a b e l ( ’n ’ , c o l o r = ’ #1C2833 ’ )
26 p l t . grid ( )
27 p l t . show ( )
28
35 # i.
36 n_1 = p∗ weights [ 0 ] + bias [ 0 ]
37 # ii .
38 a_1 = sigmoid ( n_1 )
39 # iii .
40 n_2 = p∗ weights [ 1 ] + bias [ 1 ]
41 # iv .
42 a_2 = sigmoid ( n_2 )
43 # v.
44 n_n = a_1∗ weights [ 0 ] + a_2∗ weights [ 1 ] + bias [ 2 ]
45 # vi .
46 a_a = purelin ( n_n )
47
48 # plot i .
49 p l t . t i t l e ( ’ Graph o f n_1^1 ’ )
50 p l o t t ( n_1 )
51 # plot i i .
52 p l t . t i t l e ( ’ Graph o f a_1^1 ’ )
53 p l o t t ( a_1 )
54 # plot i i i .
55 p l t . t i t l e ( ’ Graph o f n_2^1 ’ )
56 p l o t t ( n_2 )
57 # plot iv .
58 p l t . t i t l e ( ’ Graph o f a_2^1 ’ )
59 p l o t t ( a_2 )
60 # plot v .
61 p l t . t i t l e ( ’ Graph o f n^2 ’ )
62 p l o t t ( n_n )
1η Σειρά Προβλιµάτων 43
Κεφάλαιο 7. Πρόβληµα 7
63 # plot vi .
64 p l t . t i t l e ( ’ Graph o f a^2 ’ )
65 p l o t t ( a_a )
44 1η Σειρά Προβλιµάτων