Skip to content
New issue

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

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

Already on GitHub? # to your account

Linear Learner Section of learning.ipynb Doesn't Work. #1254

Open
aidan-le-beard opened this issue Apr 24, 2022 · 0 comments
Open

Linear Learner Section of learning.ipynb Doesn't Work. #1254

aidan-le-beard opened this issue Apr 24, 2022 · 0 comments

Comments

@aidan-le-beard
Copy link

aidan-le-beard commented Apr 24, 2022

The dot product from command "y = np.dot(w, x)" is resulting in the error:
ValueError: shapes (5,) and (6,) not aligned: 5 (dim 0) != 6 (dim 0)

I can't figure out how to fix this for the life of me, any advice?


ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_18692/3598892250.py in
2 iris.classes_to_numbers()
3
----> 4 linear_learner = LinearLearner(iris)
5 print(linear_learner([5, 3, 1, 0.1]))

~\aima-python\learning.py in LinearLearner(dataset, learning_rate, epochs)
528 for example in examples:
529 x = [1] + example
--> 530 y = np.dot(w, x)
531 t = example[idx_t]
532 err.append(t - y)

<array_function internals> in dot(*args, **kwargs)

ValueError: shapes (5,) and (6,) not aligned: 5 (dim 0) != 6 (dim 0)

@aidan-le-beard aidan-le-beard changed the title Linear Learner Section Doesn't Work. Linear Learner Section of learning.ipynb Doesn't Work. Apr 24, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant