https://www.deconbatch.com/2018/09/pattern-recognition.html