Root Mean Squared Error (RMSE)

Supervised Learning ใน R: การถดถอย

Nina Zumel and John Mount

Win-Vector LLC

Root Mean Squared Error (RMSE) คืออะไร?

$$ RMSE = \sqrt{\overline{(y-pred)^2}} $$

โดยที่

  • $y - pred$: ค่าความคลาดเคลื่อน หรือเวกเตอร์ส่วนเหลือ
  • $\overline{(y-pred)^2}$: ค่าเฉลี่ยของ $(y-pred)^2$
Supervised Learning ใน R: การถดถอย

RMSE ของโมเดลราคาบ้าน

# Calculate error
err <- houseprices$prediction - houseprices$price
  • price: คอลัมน์ราคาขายจริง (หน่วยพัน)
  • prediction: คอลัมน์ราคาขายที่พยากรณ์ไว้ (หน่วยพัน)
Supervised Learning ใน R: การถดถอย

RMSE ของโมเดลราคาบ้าน

# Calculate error
err <- houseprices$prediction - houseprices$price

# Square the error vector
err2 <- err^2
Supervised Learning ใน R: การถดถอย

RMSE ของโมเดลราคาบ้าน

# Calculate error
err <- houseprices$prediction - houseprices$price

# Square the error vector
err2 <- err^2

# Take the mean, and sqrt it
(rmse <- sqrt(mean(err2)))
58.33908
  • $RMSE \approx 58.3$
Supervised Learning ใน R: การถดถอย

RMSE มากหรือน้อย?

# Take the mean, and sqrt it
(rmse <- sqrt(mean(err2)))
58.33908
# The standard deviation of the outcome
(sdtemp <- sd(houseprices$price))
135.2694
  • $RMSE \approx 58.3$
  • $sd(price) \approx 135$
Supervised Learning ใน R: การถดถอย

มาฝึกกันเถอะ!

Supervised Learning ใน R: การถดถอย

Preparing Video For Download...