```from sklearn.preprocessing import PolynomialFea...
# mlforecast
m
Copy code
from sklearn.preprocessing import PolynomialFeatures

best_poly_features = PolynomialFeatures(degree=3)
X_poly = best_poly_features.fit_transform(np.array(range(len(df))).reshape(-1, 1))

best_poly_model = LinearRegression()
best_poly_model.fit(X_poly, df['Values'])

X_pred = best_poly_features.fit_transform(np.array(range(len(df), len(df) + forecast_horizon)).reshape(-1, 1))

forecast_values = best_poly_model.predict(X_pred)
df['Polynomial'] = best_poly_model.predict(X_poly)
j
You can add a trend feature and then use a scikit-learn pipeline (guide) with the poly features and the model