Data-Driven Non-Markovian Models for the Analysis and Prediction of Time-Series Data