Bias and variance are properties of the estimator which is a random variable itself. In order to accurately access those statistics you need to iterate the process many times. For this purpose, we generally use bootstrapping. However, since you work on simulated data, you can just re-generate new training samples. In any case, I will follow bootstrapping approach.
The procedure for obtaining bias and variance terms is as follows:
- Generate multiple training data sets by bootstrapping (e.g. K=200).
- For each set, train your model. You will end up with K=200 models.
- 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$).
- Average these predictions to obtain $\bar{h}$
- Then, the bias of your model (for a single sample) will be $(\bar{h}-y_i)$
- The variance will be $\sum_{k} \frac{(y_i^k-\bar{h})^2}{K-1}$
- Do this for all out-of-bag samples and average bias and variance values for better estimates.