In statistics and machine learning, the bias-variance tradeoff is a problem of trying to minimize two sources of error.
- Bias refers to the distance between the mean prediction and the true value.
- Variance refers to the variance of the prediction upon re-sampling of the training set.
trueValue <- 26
predictions <- c(24, 28, 17, 26, 23)
meanPredication <- mean(predictions)
(meanPredication - trueValue)^2 # bias squared
## [1] 5.76
mean((predictions - meanPredication)^2) # variance
## [1] 13.84