42-AI / bootcamp_machine-learning

Bootcamp to learn basics in Machine Learning
Other
205 stars 41 forks source link

ML00 ex00: examples' precision #228

Open mli42 opened 2 years ago

mli42 commented 2 years ago

In the examples there is a multiplication between a matrix containing floats and a vector containing ints. The output is written as it was int, but it should be float

Examples

m1 = Matrix([[0.0, 1.0, 2.0],
             [0.0, 2.0, 4.0]])
v1 = Vector([[1], [2], [3]])
m1 * v1
# Output:
Matrix([[8], [16]]) # << should be float
# Or: Vector([[8], [16] # << should be float

Also, sometimes, the output of a matrix has different precision (0. != 0.0):

Matrix([[0., 2., 4.], [1., 3., 5.]])
Matrix([[0.0, 1.0], [2.0, 3.0], [4.0, 5.0]])

In my opinion, it should be 0.0 everywhere

Fixed on: