Skip to content

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

Description

@aidan-le-beard

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions