I am starting a PhD in computer science, and have noticed that a number of classmates will write on LinkedIn or their academic websites that they are getting a "PhD in Machine Learning" or "PhD in Artificial Intelligence" and so on. Is this common/acceptable to write "PhD in [Area of Interest/Expertise]" instead of your home department?
I believe it makes sense. The PhD education is a very narrow education which will give you very specific knowledge regarding a specific aspect of a research area. Therefore, it makes completely sense to be a bit more specific rather than general. PhD in computer science sounds very broad and not much descriptive.
This should not be a problem. These people are providing additional information about what they are studying; nobody is going to be confused and think that they are studying under the auspices of a "department of machine learning," or whatever.
Whether people do this is cultural, and it depends on both the field and institution involved. Personally, I would not phrase things precisely this way on my c.v. However, technically, my Ph.D. degree is not "in" anything at all; no field was noted on my diploma or at my commencement ceremony. Depending on context, I might say that my degree was in "mathematics," "applied mathematics," or "mathematical physics." Which I would use would depend on my audience and what information I was trying to convey.
It sounds fine to me too. FWIW, I usually phrase it as two separate statements: I'm getting a PhD. My research/thesis topic is..."
Not only are you clarifying what your field of expertise is, you're also preventing misunderstandings. I study artificial life, but I'm in what's called the "Faculty of Engineering", and for all I know that's what will be listed on my diploma. I certainly wouldn't want people to think I was capable of building a bridge!