Should I do exercises given in online course and accompanying textbook if I want to do research in machine learning ahead?
Actually, most people require practice and reinforcement to learn much of anything. Reading and seeing isn't enough to get more that a superficial "acquaintance" with anything. Especially any thing complex. 

So, yes, you should do the exercises. Following along with the given solutions isn't the same as actually doing them. 

But, success won't come immediately, nor easily, if the topic is deep. You can also look for simpler exercises in a field if the ones you have elude you. But practice is essential for nearly everyone. The exceptions are very rare. 

Also, you need some feedback on your solutions and this is very difficult to get in a purely online course. Look for local resources to find someone who can look at the work you do and comment on it. It is possible to develop bad habits if you don't get suitable feedback. Eventually you may be able to work through those habits to better ones, but the path will be longer.