text_plain_output_1.png
from sklearn.linear_model import LinearRegression

from sklearn.linear_model import LinearRegression

from sklearn.linear_model import LinearRegression

from sklearn.preprocessing import PolynomialFeatures

import matplotlib.pyplot as plt

from sklearn.linear_model import LinearRegression
regressor = LinearRegression()
regressor.fit(X_train, y_train)

y_pred = regressor.predict(X_test)

from sklearn.preprocessing import PolynomialFeatures
poly_reg = PolynomialFeatures(degree=2)
X_poly = poly_reg.fit_transform(X_train1)
lin_reg_2 = LinearRegression()
lin_reg_2.fit(X_poly, y_train1)

plt.scatter(X_train1, y_train1, color='red')
plt.plot(X_train1, lin_reg_2.predict(poly_reg.fit_transform(X_train1)), color='blue')
plt.title('Truth or Bluff(polynomial Regression)')
plt.xlabel('Position_level')
plt.ylabel('Salary')
plt.show()