Skip to content

Instantly share code, notes, and snippets.

@petermchale
petermchale / analysis.ipynb
Last active December 2, 2023 15:46
A derivation of the bias-variance decomposition of test error in machine learning.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Author: denis.engemann@gmail.com
# License: simplified BSD (3 clause)
# Note: code is based on scipy.stats.pearsonr
from scipy import stats
def compute_corr(x, y):
x = np.asarray(x)
y = np.asarray(y)
mx = x.mean(axis=-1)
my = y.mean(axis=-1)