Spaces:
Runtime error
Runtime error
File size: 1,206 Bytes
0c6d96d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
def evaluate_model(rmse, nmae=None, rmse_max=500, nmae_max=1.0):
"""
๋ชจ๋ธ ์ฑ๋ฅ ์ ์ํ ํจ์
- RMSE์ NMAE๋ ์์์๋ก ์ข์
- RMSE๋ [0, rmse_max], NMAE๋ [0, nmae_max] ๊ตฌ๊ฐ์ผ๋ก ์ ๊ทํ
- NMAE๊ฐ ์๋ ๊ฒฝ์ฐ 0์ ์ฒ๋ฆฌ
- ์ต์ข
์ ์๋ RMSE์ NMAE ์ ์์ ๋จ์ ํ๊ท
Args:
rmse : float
๋ชจ๋ธ์ RMSE ๊ฐ
nmae : float or None
๋ชจ๋ธ์ NMAE ๊ฐ (์์ผ๋ฉด None)
rmse_max : float
RMSE ์ต๋ ๊ธฐ์ค๊ฐ (default=500)
nmae_max : float
NMAE ์ต๋ ๊ธฐ์ค๊ฐ (default=1.0)
Return:
dict : {
"rmse_score": float,
"nmae_score": float,
"final_score": float
}
"""
# RMSE ์ ์ (0~100)
rmse_score = max(0, (1 - rmse / rmse_max) * 100)
# NMAE ์ ์ (0~100)
if nmae is not None:
nmae_score = max(0, (1 - nmae / nmae_max) * 100)
else:
nmae_score = 0
# ์ต์ข
์ ์ = ๋จ์ ํ๊ท
final_score = (rmse_score + nmae_score) / 2
return final_score
# return {
# "rmse": round(rmse_score, 2),
# "nmae": round(nmae_score, 2),
# "final": round(final_score, 2)
# }
|