Understanding dimensionality reduction in machine learning models