How to Predict Polynomial Regression Data in Python


In this example, we will learn how to predict polynomial regression data in Python.

Source Code

import numpy as np

x = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23]
y = [645, 552, 450, 408, 411, 430, 418, 440, 445, 430, 560, 630]

p = np.poly1d(np.polyfit(x, y, 3))

sale = p(20)
print(sale)

Output:

519.8873834498826
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments