Learning Grid Cell Weights for Robust Representation and Effective Classification of Time Series Data