A Machine-Learning Approach for Earthquake Magnitude Estimation