Below is my code
import numpy as np
from sklearn.linear_model import LinearRegression
X = np.array([[1], [2], [3], [4]])
y = np.array([[6],[8], [2], [2]])
reg = LinearRegression().fit(X, y)
print("Next will mine in", reg.predict([[5]]))
and respond for value 5 prediction comes to be
Next will mine in [[-1.77635684e-15]]
I don't get why this highly large negative number?
CodePudding user response:
That's a very small negative number, close to zero:
-0.00000000000000177635684
a_float = 3.14159
formatted_float = "{:.2f}".format(a_float)