The MSE and its components (squared bias and variance) are random variables. Therefore, in order to accurately access these statistics you need to iterate the process many times. For this purpose, we generally use bootstrapping. The procedure for obtaining bias and variance terms is as follows: 1. Generate multiple training data sets by bootstrapping (e.g. K=200). 2. For each set, train your model. You will end up with K=200 models. 3. For each model, predict the targets for the out-of-bag samples (samples which did not appear in the training sets). Now, for each out-of-bag sample $(x_i,y_i)$ you can obtain K predictions (say $h^1, h^2,.....,h^k$). 4. Average these predictions to obtain $\bar{h}$ 5. Then, the bias of your model (for a single sample) will be $(\bar{h}-y_i)$ 6. The variance will be $\sum_{k} \frac{(y_i^k-\bar{h})^2}{K-1}$ 7. Do this for all out-of-bag samples and average bias and variance values for better estimates.