Assessing the Number of Linear Components in a General Regression Problem