Computational modeling and design of mechanical metamaterials: A machine learning approach