Excuse my ignorance I have never used polynomial regression with numpy before.
I am attempting to use the variable "CPU_frequency" to create Polynomial features. Using three different values of polynomial degrees.
import numpy
X = X.to_numpy().flatten()
f1 = np.polyfit(X, Y, 1)
p1 = np.poly1d(f1)
f3 = np.polyfit(X, Y, 3)
p3 = np.poly1d(f3)
f5 = np.polyfit(X, Y, 5)
p5 = np.poly1d(f5)
yields
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[74], line 3
1 import numpy
----> 3 X = X.to_numpy().flatten()
4 f1 = np.polyfit(X, Y, 1)
5 p1 = np.poly1d(f1)
AttributeError: 'numpy.ndarray' object has no attribute 'to_numpy'
attempted change from X. to X._ no joy. reminded jupyter it was using numpy by calling import.
any help appreciated.
if you need to flatten you can directly use flatten()
on numpy.ndarray
object
X = X.flatten()
Link to doc: https://numpy.org/doc/stable/reference/generated/numpy.ndarray.flatten.html