In Chapter 3, in section Predicting with Multiple Inputs & Outputs code,
def vect_mat_mul(vect,matrix):
assert(len(vect) == len(matrix)
the aim is to check that the number of inputs is equal to the number of weights for every output. But in fact len(matrix) corresponds to the number of outputs not number of weights. To check for the number of weights, we should write something like:
def vect_mat_mul(vect,matrix):
assert(len(vect) == len(matrix[0])
for example
- Also in the part of the code:
for i in range(len(vect)):
output[i] = w_sum(vect,matrix[i])
it should be:
for i in range(len(matrix)):
output[i] = w_sum(vect,matrix[i])
because we perform the weighted sum for each output, not for each input.
In Chapter 3, in section Predicting with Multiple Inputs & Outputs code,
the aim is to check that the number of inputs is equal to the number of weights for every output. But in fact
len(matrix)corresponds to the number of outputs not number of weights. To check for the number of weights, we should write something like:for example
it should be:
because we perform the weighted sum for each output, not for each input.