Tim Wong
深思心思
Published in
2 min readJan 2, 2020

--

[ML] R² vs MSE

日期: 2020-Jan-2, 作者: Tim Wong

為了加大產量,2020年起,文筆不怎樣的我會用更簡潔更直接。那開始吧。

在為 linear regression 計分時,我們用R² 而不用Machine Learning 多用的 mean square error,為什麼?

MSE = 1/n * sumOf[(y_true - y_pred)^2]|[from 1 to N]想想,(y_pred-y_true)是absolute value,例如:MSE是100美元,可以理解為780港元,那MSE變得很不標準,就是沒有normalize/standardize,而令分析很漂忽。

而為了normalize error 到0到1之間,可用 R²:

R^2 = 1 - SSE/TSS 
= 1 - sumOf[(y_true - y_pred)^2]/sumOf[(y_true-y_mean)^2]
where SSE = square sum of error; TSS = total sum of square
Therefore SSE/TSS = error-of-regression within the TSS
故,最大的 error-of-regeression 是 sumOf([y_true-y_mean)^2)
而 " 1- " 就是指出有多少本來是error 的數已俾這個regression model結解釋了,

最重要是R² 在「0~1]之間。

全力衝刺中的一團火

我是阿Tim | timwong.ai@gmail.com

--

--