Error
Hello,
I am trying to run this python code but I am receiving an error in the following line of code
print "Starting gradient descent at b = {0}, m = {1}, error = {2}".format(initial_b, initial_m, compute_error_for_line_given_points(initial_b, initial_m, points))
Hi @Mayssa-1195, what version of Python are you using? What is the error?
I am using Python version 3.8.3. This is the error:
File "gradient_descent_example.py", line 39 print "Starting gradient descent at b = {0}, m = {1}, error = {2}".format(initial_b, initial_m, compute_error_for_line_given_points(initial_b, initial_m, points)) ^ SyntaxError: invalid syntax
Some of the code doesn't work in Python 3. If you change the print statements to function calls, like
print("Starting gradient descent at b = {0}, m = {1}, error = {2}".format(initial_b, initial_m, compute_error_for_line_given_points(initial_b, initial_m, points)))
That may be enough to get things working.
@mattnedrich Okay Thank you ! I will try it