Unable to test my code because of the lab provided code erroring out and not allowing a way to fix.
<class ‘numpy.ndarray’>
TypeError Traceback (most recent call last)
in
5 cost = compute_cost(x_train, y_train, initial_w, initial_b)
6 print(type(cost))
----> 7 print(f’Cost at initial w: {cost:.3f}')
8
9 # Public tests
TypeError: unsupported format string passed to numpy.ndarray.format
TMosh
February 26, 2023, 9:08pm
2
The problem is that the value returned by your compute_cost() function is the wrong type or shape.
Thanks, you’re spot on – my learning Python syntax appears to have done this!
TMosh
February 26, 2023, 9:17pm
4
The course makes the assumption you’re already familiar with writing code in Python. So it’s a difficult environment if you’re starting from scratch.
Fairly simple language when coming from C++ and Java, just the formatting is a bit different…
TMosh
February 26, 2023, 9:42pm
6
Python is heavily dependent on whitespace and indentation (not one of its more pleasant characteristics in my opinion), which catches a lot of students out.
Hello, So, how did you resolve this?