Střední kvadratická chyba (RMSE)

Supervised Learning in R: Regression

Nina Zumel and John Mount

Win-Vector LLC

Co je střední kvadratická chyba (RMSE)?

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

kde

  • $y - pred$: chyba neboli vektor reziduí
  • $\overline{(y-pred)^2}$: střední hodnota $(y-pred)^2$
Supervised Learning in R: Regression

RMSE modelu cen prodeje domů

# Calculate error
err <- houseprices$prediction - houseprices$price
  • price: sloupec skutečných prodejních cen (v tisících)
  • prediction: sloupec predikovaných prodejních cen (v tisících)
Supervised Learning in R: Regression

RMSE modelu cen prodeje domů

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

# Square the error vector
err2 <- err^2
Supervised Learning in R: Regression

RMSE modelu cen prodeje domů

# 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 in R: Regression

Je RMSE velká nebo malá?

# 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 in R: Regression

Pojďme procvičovat!

Supervised Learning in R: Regression

Preparing Video For Download...