Topological data analysis and machine learning framework for studying time series and image data