def _bias_correction(V_IJ, inbag, pred_centered, n_trees):
n_train_samples = inbag.shape[<NUM_LIT:0>]<EOL>n_var = np.mean(np.square(inbag[<NUM_LIT:0>:n_trees]).mean(axis=<NUM_LIT:1>).T.view() -<EOL>np.square(inbag[<NUM_LIT:0>:n_trees].mean(axis=<NUM_LIT:1>)).T.view())<EOL>boot_var = np.square(pred_centered).sum(axis=<NUM_LIT:1>) / n_trees<EOL>bias_correction = n_train_samples * n_var * boot_var / n_trees<EOL>V_IJ_unbiased = V_IJ - bias_correction<EOL>return V_IJ_unbiased<EOL>
Helper functions that implements bias correction

Parameters
----------
V_IJ : ndarray
    Intermediate result in the computation.

inbag : ndarray
    The inbag matrix that fit the data. If set to `None` (default) it
    will be inferred from the forest. However, this only works for trees
    for which bootstrapping was set to `True`. That is, if sampling was
    done with replacement. Otherwise, users need to provide their own
    inbag matrix.

pred_centered : ndarray
    Centered predictions that are an intermediate result in the
    computation.

n_trees : int
    The number of trees in the forest object.