If you forgot your pattern/PIN/ No email setting for an android device in that situation following steps will help.
[1] You must be rooted and TWRP 3.x installed. If you don't have TWRP then use ADB from PC (connect phone to pc and follow step 4)
[2] Reboot and enter into TWRP (press power + vol up keep + home button) recovery mode.
[3] Click "Advance" button and "Terminal" in the next screen.
[4] If you have Marshmallow then goto "cd /data/system" directory. Now type "rm generate.pattern.key" If you are on different version of android in that case name of file might be different but look out for file "pattern.key"
Now reboot the phone and pattern is gone. You can set it again from settings without doing factory reset.