Scikit-Learn
56
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model
import LinearRegression
from sklearn.pipeline import
Pipeline
import numpy as np
#Next, create an
object of Pipeline tool
Stream_model = Pipeline([('poly', PolynomialFeatures(degree=3)),
('linear', LinearRegression(fit_intercept=False))])
#
Provide the size of array and order of polynomial data to fit the model.
x = np.arange(5)
y = 3 - 2 * x + x ** 2 - x ** 3
Stream_model = model.fit(x[:, np.newaxis], y)
#Calculate the input
polynomial coefficients
Dostları ilə paylaş: