This details the use of Markov Switching Autoregressions for the detection of underlying regimes in financial time series. A Random Forest Classifier is used to make a prediction as to the classification of the regime in the next time period.
Link to the medium article: https://medium.com/@spencer13luck/time-series-regime-analysis-in-python-ffdc7aa005dd