A Statistical Mechanics Framework for Task-Agnostic Sample Design in Machine Learning