DLS2 week3: programming assignment eror linear_function

Hi everyone:)

the very first functionto be defined: linear_function won’t return the expected value:

my code:
{mentor edit: code removed}

the result:
[[0.90226924]
[0.7439407 ]
[1.0854228 ]
[0.8581807 ]]

the expected result:
[[-2.15657382]
[ 2.95891446]
[-1.08926781]
[-0.84538042]]

note that I did try leaving the typedefinition away, as well as including the name tag for the tf.constants, but the values obviously do not change.

could it be that the nb.random.seed(1) content changed?

thanks for any help!

Bene

The error you encountered in Exercise 1 - linear_function is likely related to how the random numbers are generated. Based on your code in the linear_function, you used np.random.rand() instead of np.random.randn(). The rand() function generates random numbers between 0 and 1, while randn() generates random numbers from a normal distribution (centered at 0 with a standard deviation of 1).

2 Likes

Just a reminder, please avoid posting your code in the future, that’s not allowed by the Code of Conduct.

oh damn, thanks @nadtriana
alright sorry, won’t do it again @TMosh

2 Likes