When the Normal Equations Break showed what happens when one feature is exactly a combination of the others: is singular and no single best exists. Real data is rarely that tidy. Far more often a feature is almost a combination of the others, like a used car's age and its mileage. is then still invertible, but only just, and the fitted weights become fragile: small changes to the data swing them wildly. This is the multicollinearity practitioners check for before fitting.
The variance inflation factor (VIF) puts a number on it, one per feature. To score feature :
Here are the fitted values and is the mean of . The bottom measures how much column varies around its own average; the top measures how much of that variation the other features failed to reproduce. means the other features tell you nothing about feature , and close to 1 means feature is nearly redundant.
A VIF of 1 means no overlap at all. A common rule of thumb treats anything above about 5 to 10 as a warning sign.
Task: write vif(X). X is a design matrix given as a list of rows: one row per example, one column per feature, at least two features, and no column of 1s. Return the list of VIFs, one per feature in column order, each rounded to 4 decimal places.
In every test, no column is constant and no column is an exact combination of the others, so every fit has a unique solution and every .