Pattern based analysis