text_plain_output_1.png
model1 = LinearRegression()
model1.fit(total_X, total_y)
model2 = LinearRegression()
model2.fit(men_X, men_y)
model3 = LinearRegression()
model3.fit(women_X, women_y)

pred_total = model1.predict(total_X)
pred_men = model2.predict(men_X)
pred_women = model3.predict(women_X)

"""
MSE_total:16949.508877183063
MSE_men:10974.075600749911
MSE_women:3972.9602897642253
"""
mse_total = mean_squared_error(pred_total, total_y)
print(f'MSE_total:{mse_total}')
mse_men = mean_squared_error(pred_men, men_y)
print(f'MSE_men:{mse_men}')
mse_women = mean_squared_error(pred_women, women_y)
print(f'MSE_women:{mse_women}')