Skip to content Skip to sidebar Skip to footer

Typeerror: Only Length-1 Arrays Can Be Converted To Python Scalars Dot Product

Writing this algorithm for my final year project. Debugged a few, but stuck on this. Tried changing the float method but nothing really changed. ----> 8 hypothesis = np.

Solution 1:

x is a numpy array, which Python's builtin float function can't handle. Try:

hypothesis = np.dot(x.astype(float), theta)

Post a Comment for "Typeerror: Only Length-1 Arrays Can Be Converted To Python Scalars Dot Product"