In common statistical textbooks' linear regression topic, Mean Squared Error is often defined as $$MSE = \dfrac{(y-\hat{y})^T(y-\hat{y})}{n-p} = \dfrac{RSS}{n-p}$$ where the $y$ and $\hat{y}$ is a column vector containing each y and its predicted values respectively, RSS is the residual sum of squares, and n is the number of training samples, p being the number of variables including the intercept term. It can be shown that this definition of MSE is the unbiased estimator of the variance of the error term $\varepsilon$.
Now, the question comes, in Python's sklearn, or in fact in most ML books, MSE is just simply defined as the more intuitive (at least for me) $$MSE = \dfrac{RSS}{n}$$
Although one can argue as $n \to \infty$, both MSE converges to the same values. But I still get very confused over which one to use and why the difference? If someone can link me or explain to me it would be great; I tried searching but I dont see a common answer.