Last active
January 19, 2022 10:12
-
-
Save sh16ma/40c7c58b5ad0b7589fa263103279b97c to your computer and use it in GitHub Desktop.
#🐍 #Python #評価指標 #回帰
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# libraries | |
import numpy as np | |
from sklearn.metrics import r2_score # 決定係数(R^2) | |
from sklearn.metrics import mean_squared_error # 平均二乗誤差(MSE) | |
from sklearn.metrics import mean_absolute_error # 平気絶対値誤差(MAE) | |
# ------------------------------ | |
# 途中式割愛 | |
# ------------------------------ | |
print(f"R2スコア : {r2_score(answer, predict)}") | |
print(f"MSE : {mean_squared_error(answer, predict)}") | |
print(f"MAE : {mean_absolute_error(answer, predict)}") | |
# 二乗平方根誤差(RMSE) | |
mse = mean_squared_error(answer, predict) | |
print("RMSE",np.sqrt(mse)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment