text_plain_output_1.png
from sklearn.linear_model import LinearRegression

from sklearn.metrics import mean_absolute_error,mean_squared_error,r2_score

import numpy as np # linear algebra

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)

train_MSE = mean_squared_error(train_y, predict_train)
test_MSE = mean_squared_error(test_y, predict_test)

train_RMSE = np.sqrt(train_MSE)
test_RMSE = np.sqrt(test_MSE)

train_MAPE = np.mean(np.abs(train_y, predict_train))
test_MAPE = np.mean(np.abs(test_y, predict_test))

print('train_MAPE: ', train_MAPE)
print('test_MAPE: ', test_MAPE)