I will soon graduate with a data science MSc and am specializing in AI/machine learning, in which I would like to do research. I can read, understand and apply research papers pretty well, but I don't feel like I have the background to actually do research. When an author derives something, I sometimes need a few minutes to make sure that the math is sound. This comes from the fact that my undergrad school is only really good at teaching software development, and most of the courses I could take ended up being linked to that, neglecting the mathematical side of things.
The most worrying thing is that I don't feel completely sure about my choice of fields, since I have not been exposed to serious courses in most subjects that interest me. My bad results in math years ago were not from lack of interest, and I would have liked to take some serious courses in math and related areas, and give myself some time to decide what to do. This will probably become harder when I enter the job market. I may also have good PhD opportunities in machine learning through my job, which makes it even riskier to leave and start another degree without being sure I will like the field and do well in it.
I have started working through textbooks in various areas (linear and abstract algebra, statistics, machine learning), but without a clear plan, it's hard to prioritize self-study and focus effectively. There are too many interesting areas and not enough time and energy to learn all of them. Finally, I can't be sure that I am learning well or just getting the illusion of progress, since a set of textbooks can't replace a structured degree program.
How can I make sure that I'm ready and in the right field when I start applying for grad school? I'm not afraid of "losing" a few years to get another degree, if that's part of the answer.