Machine learning at the nanoscale