I'm a fourth year undergraduate student planning on applying to grad programs this fall. I will mainly be applying to PhD and research thesis master programs in machine learning and computer architecture. They would fall under the computer science or electrical/computer engineering departments.
I did part time research under a professor this school year. It was something I initiated/approached him about, asking for something interesting I could work on. We eventually co-authored a paper together and successfully published it.
Because of this being a positive experience, I plan on asking this professor for a reference letter for grad school.
He was an incredible supervisor, and I really enjoyed the work, however I don't see myself spending my life working in his field, so I'm not particularly interested in going to grad school for it.
He's obviously not a kid and I highly doubt he'll take it personally, so I'm not worried about him being insulted. However, as I mentioned before, I approached him at the beginning of the year saying his work looked interesting. Additionally, he was happy with my work so he decided to pay me for it. My main concern is that he will be annoyed that I made him invest so much time and money in me only for me to then claim I'm not really interested in his work. I did find the work interesting, but not interesting enough to spend years working in it. His field is signal processing algorithms, so fairly different from the machine learning and computer architecture programs I'll be applying to.