Switching from physics Masters to machine learning PhD I am doing a Masters in theoretical physics. It's been half a year since I've begun my Masters.

Recently, I find myself intrigued by machine learning and would like to do a PhD in machine learning after I finish my Masters in theoretical physics.

I am rather afraid to break it to my supervisor that I plan to move into machine learning after my Masters. I am also afraid how he might react if he finds out that I am taking courses in the Computer Science department. I plan to work with machine learning profs to get two recommendation letters, but I guess I must have a third letter from my physics supervisor. I am afraid that he will not write me a good letter for PhD admission into machine learning.

What should I do?
I would suggest that you make as smooth and timely a transition as you can. The more dramatic a change you make, the more damage you risk doing to your network of relationships. Tell your advisor about your interests while making clear that you remain committed to the program you're in. 

Now, there are some advantageous tactics for studying several fields at once. First, modulate your commitments -- if half your courseload is in another department, that might be too much. Second, combine them wherever you can. Certainly you could train a neural network on solid models to recognize favorable heat dissipation, say.