This was the solution for me:
askubuntu.com/questions/803640/system-fr...with-intel-bay-trail
You just need to pass a kernel boot parameter and the random freezing stops completely. The parameter may increase battery consumption slightly, but it will give you a usable system.
You do this by editing the configuration file for GRUB:
Boot Ubuntu and open a terminal by pressing Ctrl+Alt+T then type
sudo nano /etc/default/grub
Find the line that starts GRUB_CMDLINE_LINUX_DEFAULT=
This needs to be changed to include intel_idle.max_cstate=1
So after your edit it reads something like
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_idle.max_cstate=1"
quiet and splash are default parameters for Ubuntu Desktop - no need to change them, or any other pre-existing parameters
Now save the file by pressing ctrl+o then enter and exit by pressing ctrl+x
Now run
sudo update-grub
Then reboot.
It's work for me, no more freezing.