Skip to article frontmatterSkip to article content

Influence functions

Assume our training data consists of nn samples from X×Y\mathcal{X} \times \mathcal{Y} and we have trained a model with parameters θn\theta_n, e.g. through maximum likelihood estimation θn=arg min1ni=1nL(xi,yi;θ)\theta_n = \argmin \frac{1}{n} \sum_{i=1}^n L(x_i, y_i; \theta). We would like to understand the influence of a single training datapoint (xj,yj)(x_j, y_j) on our parameters. The naive approach would be to refit the model without this datapoint, i.e. θnj=arg minijL(xi,yi;θ)\theta_{n\setminus j} = \argmin \sum_{i \neq j} L(x_i, y_i; \theta). It is clear that for e.g. neural networks this is not feasible on a large scale. Influence functions (IF) offer a possible solution. Before we discuss IF we need to consider how we measure influence of a single datapoints, here multiple options present themselves:

We will begin by considering the second options.

It has been shown, Cook & Weisberg, 1986 that by upweighting the loss of (xj,yj)(x_j, y_j), we can effeciently compute the change using second order approximations. To this end we define θϵ,nj=arg min1ni=1nL(xi,yi;θ)+ϵL(xj,yj)\theta_{\epsilon, n\setminus j} = \argmin \frac{1}{n} \sum_{i=1}^n L(x_i, y_i; \theta) + \epsilon L_(x_j, y_j). Essentially we weight the loss of (xj,yj)(x_j, y_j) by an additional factor of ϵ\epsilon. Then

Iθ(j)=dθϵ,njdϵϵ=0=Hθ1θL(xj,yj;θn)I_\theta(j) = \frac{d\theta_{\epsilon, n\setminus j}}{d \epsilon} \Bigr|_{\epsilon=0} = - H_\theta^{-1} \nabla_\theta L(x_j, y_j; \theta_n)

The key insight now, is to notice that upweighting by ϵ=1n\epsilon = -\frac{1}{n} corresponds to removing (xj,yj)(x_j, y_j). Further we can also compute the change of loss for a test point in closed form:

IL(j,(x,y))=dL(x,y;θϵ,nj)dϵϵ=0=θL(x,y;θn)THθ1θL(xj,yj;θn)I_L(j, (x, y)) = \frac{d L(x, y; \theta_{\epsilon, n \setminus j})}{d \epsilon} \Bigr|_{\epsilon=0} = -\nabla_\theta L(x, y; \theta_n)^T H_\theta^{-1} \nabla_\theta L(x_j, y_j; \theta_n)
References
  1. Cook, R. D., & Weisberg, S. (1986). Residuals and Influence in Regression. Chapman. https://books.google.de/books?id=aMDpswEACAAJ