Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistake in Ch3. code #60

Open
ahussein1194 opened this issue Oct 26, 2022 · 0 comments
Open

Mistake in Ch3. code #60

ahussein1194 opened this issue Oct 26, 2022 · 0 comments

Comments

@ahussein1194
Copy link

ahussein1194 commented Oct 26, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant