text_plain_output_1.png
from sklearn.linear_model import LinearRegression

from sklearn.metrics import mean_absolute_error,mean_squared_error,r2_score

from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(train_x, train_y)

predict_train = model.predict(train_x)
predict_test = model.predict(test_x)

r2_train = r2_score(train_y, predict_train)
r2_test = r2_score(test_y, predict_test)

print('r2_train: ', r2_train)
print('r2_test: ', r2_test)