For fitting I am using sklearn LinearRegression with weighted values:
from sklearn.linear_model import LinearRegression
regr = LinearRegression()
regr.fit(x, y, w)
plt.scatter(x, y, color='black')
plt.plot(x, regr.predict(x), color='blue', linewidth=3)
However, now my data is not showing a linear behaviour, but a quadratic. So I tried to implement the polynomicFeatures:
from sklearn.preprocessing import PolynomialFeatures
regr = PolynomialFeatures()
regr.fit(x, y, w)
plt.scatter(x, y, color='black')
plt.plot(x, regr.predict(x), color='blue', linewidth=3)
However, the PolynomialFeatures fit function seems not to allowing a sample_weight parameter in its fit-function. Is there a way to use weights with polynomial fits anyway?