bootcamp_machine-learning icon indicating copy to clipboard operation
bootcamp_machine-learning copied to clipboard

Day01 Ex00 wrong shape examples

Open ezalos opened this issue 4 years ago • 0 comments

  • Day: 01
  • Exercise: 00

The docstring of predict_(x, theta) define its arguments of shape (m, 1) and (2, 1):

Args:
x: has to be an numpy.ndarray, a vector of dimensions m * 1.
theta: has to be an numpy.ndarray, a vector of dimension 2 * 1.

But the examples in the subject are of dimension (m,):

mport numpy as np
x = np.arange(1,6)
# Example 1:
theta1 = np.array([5, 0])
predict_(x, theta1)
# Ouput:
array([5., 5., 5., 5., 5.])
# Do you remember why y_hat contains only 5's here?
# Example 2:
theta2 = np.array([0, 1])
predict_(x, theta2)
# Output:
array([1., 2., 3., 4., 5.])
# Do you remember why y_hat == x here?
# Example 3:
theta3 = np.array([5, 3])
predict_(x, theta3)
# Output:
array([ 8., 11., 14., 17., 20.])
# Example 4:
theta4 = np.array([-3, 1])
predict_(x, theta4)
# Output:
array([-2., -1., 0., 1., 2.])
3

Fixed on:

  • [x] Github
  • [ ] Gitlab

ezalos avatar Nov 16 '21 16:11 ezalos