oreilly_essential_math_for_data_science_book
oreilly_essential_math_for_data_science_book copied to clipboard
Chapter 5 Example 5-23
New to data science and Python in general. Been trying to run the example code in my Kaggle notebook (maybe that's the underlying issue here) and what I'm getting while printing the output is:
Coefficients = [1.93939394]
Intercept = 4.7333333333333325
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[10], line 20
18 print("Coefficients = {0}".format(fit.coef_))
19 print("Intercept = {0}".format(fit.intercept_))
---> 20 print("z = {0} + {1}x + {2}y".format(fit.intercept_, fit.coef_[0], fit.coef_[1]))
IndexError: index 1 is out of bounds for axis 0 with size 1
Looks like there's only 1 coefficient in the array, hence the out of bounds error.