based on this paper https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2422183 by Lopez de Prado
There is also kca_struct_chg.py version that implements the monitoring of market's structural regime change in oder to optimize the active model on new data and trade it before a new regime change happens