Optimizing Sparse Linear Algebra Through Automatic Format Selection and Machine Learning