AI 101
\[ \sum_{i=1}^{n} w_i \times x_i \]
fiv belongs to.fiv1 in the fiveth position, and zeroes elsewhere.multi = np.array([
[-1/1, -1/1, -1/1, -1/1, 1/1, -1/1, -1/1, -1/1, -1/1],
[-1/2, -1/2, 1/2, -1/2, -1/2, -1/2, 1/2, -1/2, -1/2],
[-1/3, -1/3, 1/3, -1/3, 1/3, -1/3, 1/3, -1/3, -1/3],
[ 1/4, -1/4, 1/4, -1/4, -1/4, -1/4, 1/4, -1/4, 1/4],
[ 1/5, -1/5, 1/5, -1/5, 1/5, -1/5, 1/5, -1/5, 1/5],
[ 0/6, 3/6, 0/6, 3/6, -6/6, 3/6, 0/6, 3/6, 0/6],
])[[-1. -1. -1. -1. 1. -1.
-1. -1. -1. ]
[-0.5 -0.5 0.5 -0.5 -0.5 -0.5
0.5 -0.5 -0.5 ]
[-0.33333333 -0.33333333 0.33333333 -0.33333333 0.33333333 -0.33333333
0.33333333 -0.33333333 -0.33333333]
[ 0.25 -0.25 0.25 -0.25 -0.25 -0.25
0.25 -0.25 0.25 ]
[ 0.2 -0.2 0.2 -0.2 0.2 -0.2
0.2 -0.2 0.2 ]
[ 0. 0.5 0. 0.5 -1. 0.5
0. 0.5 0. ]]
9) “sensory neurons.| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |
0 or 1 or perhaps True or False etc.| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
13 and 5 - where corners matter too.multi = np.array([
[-1/1, -1/1, -1/1, -1/1, 1/1, -1/1, -1/1, -1/1, -1/1],
[-1/2, -1/2, 1/2, -1/2, -1/2, -1/2, 1/2, -1/2, -1/2],
[-1/3, -1/3, 1/3, -1/3, 1/3, -1/3, 1/3, -1/3, -1/3],
[ 1/4, -1/4, 1/4, -1/4, -1/4, -1/4, 1/4, -1/4, 1/4],
[ 1/5, -1/5, 1/5, -1/5, 1/5, -1/5, 1/5, -1/5, 1/5],
[ 0/6, 3/6, 0/6, 3/6, -6/6, 3/6, 0/6, 3/6, 0/6],
])multi = np.array([
[-1/1, -1/1, -1/1, -1/1, 1/1, -1/1, -1/1, -1/1, -1/1],
[-1/2, -1/2, 1/2, -1/2, -1/2, -1/2, 1/2, -1/2, -1/2],
[-1/3, -1/3, 1/3, -1/3, 1/3, -1/3, 1/3, -1/3, -1/3],
[ 1/4, -1/4, 1/4, -1/4, -1/4, -1/4, 1/4, -1/4, 1/4],
[ 1/5, -1/5, 1/5, -1/5, 1/5, -1/5, 1/5, -1/5, 1/5],
[ 0/6, 3/6, 0/6, 3/6, -6/6, 3/6, 0/6, 3/6, 0/6],
])multi = np.array([
[-1/1, -1/1, -1/1, -1/1, 1/1, -1/1, -1/1, -1/1, -1/1],
[-1/2, -1/2, 1/2, -1/2, -1/2, -1/2, 1/2, -1/2, -1/2],
[-1/3, -1/3, 1/3, -1/3, 1/3, -1/3, 1/3, -1/3, -1/3],
[ 1/4, -1/4, 1/4, -1/4, -1/4, -1/4, 1/4, -1/4, 1/4],
[ 1/5, -1/5, 1/5, -1/5, 1/5, -1/5, 1/5, -1/5, 1/5],
[ 0/6, 3/6, 0/6, 3/6, -6/6, 3/6, 0/6, 3/6, 0/6],
])np.random.rand and tell it what shape we want.0 and 1 by default.[[0.13819755 0.858514 0.89387389 0.97953215 0.95078702 0.91339183
0.55505456 0.05400497 0.76328784]
[0.61992175 0.60798114 0.47795787 0.99881325 0.21490773 0.1434384
0.24203858 0.96896522 0.44601858]
[0.32932856 0.81046388 0.98930022 0.72729313 0.19500454 0.34640125
0.48504912 0.72482006 0.13982303]
[0.86507991 0.15626278 0.73353581 0.0778394 0.23396891 0.53146514
0.62610878 0.30177633 0.65322222]
[0.30151646 0.17771519 0.31744043 0.70558929 0.92332405 0.86750924
0.06348737 0.10571363 0.8207625 ]
[0.18535997 0.81312843 0.86835174 0.80318644 0.5531322 0.4545896
0.96877004 0.93137333 0.08946593]]
.1 or something..1 or something.array([[ True, False, False, False, False, False],
[False, True, False, False, False, False],
[False, False, True, False, False, False],
[False, False, False, True, False, False],
[False, False, False, False, True, False],
[False, False, False, False, False, True]])
@ is the special NumPy “operator” for matrix multiplication.
np.equal to compare all of the matrix positions to see if they are equal.array([[False, True, True, True, True, True],
[False, False, False, False, True, False],
[False, True, True, False, False, False],
[False, False, False, True, False, False],
[False, False, False, False, True, False],
[False, False, False, False, False, True]])
six, which previously had six dots multiplied by one, now has 6 dots mulitiplied by \(\frac{1}{6}\) each.array([[0. , 0. , 0. , 0. , 1. ,
0. , 0. , 0. , 0. ],
[0. , 0. , 0.5 , 0. , 0. ,
0. , 0.5 , 0. , 0. ],
[0. , 0. , 0.33333333, 0. , 0.33333333,
0. , 0.33333333, 0. , 0. ],
[0.25 , 0. , 0.25 , 0. , 0. ,
0. , 0.25 , 0. , 0.25 ],
[0.2 , 0. , 0.2 , 0. , 0.2 ,
0. , 0.2 , 0. , 0.2 ],
[0.16666667, 0. , 0.16666667, 0.16666667, 0. ,
0.16666667, 0.16666667, 0. , 0.16666667]])
for - over all the classifications and update accordingly.What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
What goes here?
enumerate function to get back a row and its location with in the matrix.Location is 0 and row is [False True True True True True]
Location is 1 and row is [ True False True True True True]
Location is 2 and row is [ True True False True True True]
Location is 3 and row is [ True True True False True True]
Location is 4 and row is [ True True True True False True]
Location is 5 and row is [ True True True True True False]
[] notation to look up the part of the learning matrix that corresponds to the same row.Location is 0 and row is [False True True True True True] and weights are [0.13819755 0.858514 0.89387389 0.97953215 0.95078702 0.91339183
0.55505456 0.05400497 0.76328784]
Location is 1 and row is [ True False True True True True] and weights are [0.61992175 0.60798114 0.47795787 0.99881325 0.21490773 0.1434384
0.24203858 0.96896522 0.44601858]
Location is 2 and row is [ True True False True True True] and weights are [0.32932856 0.81046388 0.98930022 0.72729313 0.19500454 0.34640125
0.48504912 0.72482006 0.13982303]
Location is 3 and row is [ True True True False True True] and weights are [0.86507991 0.15626278 0.73353581 0.0778394 0.23396891 0.53146514
0.62610878 0.30177633 0.65322222]
Location is 4 and row is [ True True True True False True] and weights are [0.30151646 0.17771519 0.31744043 0.70558929 0.92332405 0.86750924
0.06348737 0.10571363 0.8207625 ]
Location is 5 and row is [ True True True True True False] and weights are [0.18535997 0.81312843 0.86835174 0.80318644 0.5531322 0.4545896
0.96877004 0.93137333 0.08946593]
backup”)learn”)array([[1, 0, 0, 0, 1, 0],
[1, 0, 1, 0, 0, 1],
[1, 0, 0, 0, 0, 1],
[0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 0]])
1 here.+ 0 to turn into numbers so the array is smaller and easier to read)True + 0 is 1 and False + 0 is 0 - don’t worry about it)array([[1, 0, 1, 0, 1, 0],
[0, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1]])
1 here.array([[1, 0, 1, 0, 1, 0],
[0, 1, 1, 1, 1, 1],
[0, 0, 1, 0, 1, 0],
[0, 0, 0, 1, 1, 1],
[0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 1]])
\[ \begin{align} \text{Precision} &= \frac{tp}{tp + fp} \\ \text{Recall} &= \frac{tp}{tp + fn} \, \end{align} \]
array([[False, False, False, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False],
[False, False, False, False, False, False]])