"Catching up" after two years in the wrong school I'm a student in a mid-ranked computer engineering school in France. This is unsatisfying to me for several reasons:


I recently discovered that I strongly prefer the mathematical aspects of computer science to the programming side of it, and I would like to continue my career working on machine learning/statistics, which is not an option in my current school. I've done pure mathematics and physics in my two years of preparatory classes, which ended a year and a half ago, but haven't had a proper math course since then, except for some probabilities and Boolean logic.
The school's ranking and course offering are disappointing to me. I am there as a result of a bad personal situation during my first undergrad years, and I would have aimed for a completely different path if I could.


I'm in my first year of Master's degree (4th year after high school), and considering my options. I wonder if, by working hard enough, it's still possible to get a more theoretical degree from a good school, or if it's already too late to try again and my academic path is set.

Additionally, I would like to go finish my studies abroad at some point, and already have a few cities and universities in mind. I would like a researcher or research engineer's position in the private sector.

I am considering the following options:


Finishing my Master's degree while catching up on maths on the side, then trying to get into a PhD programme abroad.
Finishing my Master's, finding work in a machine learning- or statistics-related field for one year, then applying to a PhD programme. The year off would give me more time to get the required level in maths, and the professional experience could be useful when applying.
Trying right away to get into another school's Master's programme that would be better adapted to my plans.


For all I know, all of these may be unrealistic (starting a PhD after two years without math courses would at least require a lot of work on the side, and I don't see how my application could have a chance without a math-related degree to prove I'm competent; getting into a foreign school's master's programme is probably a very selective and/or expensive transition, especially if I'm coming from a lower-ranked institution).

The ideal way would be to go back to high school and do the preparatory classes again, this time without external problems to discourage me. Of course, this isn't possible.

I realize that what I want to do is hard. I kind of regret the low motivation I had and the choices I made a few years ago. I am mostly trying to get an overview of what I can aim for and what is off the table. What would be a good way to proceed from here?
First of all, nothing is off the table. You are still in the very beginning of your academic path and nothing is closed off irrevocably. You are correct in thinking that a CS degree will require you to catch up on fundamentals. The question is how much time and effort would you like to invest in this endeavor. I don't think that dropping out of the engineering program is necessary. A lot of people transition from engineering to CS, you are by no means the first to want to make the switch. 

So what are the options of a master of engineering holder to get into a CS PhD? 


Doing nothing: You can probably get into some CS PhD program right now if your research statement/references are good, though you are not likely to get into one of the top international programs. School rank does not matter in PhD as much as your ability to find a good advisor with whom you are able to publish! This is a function of your mutual fit and joint capability, not the school's ranking. 
Getting a master in CS: if you want to get some foundational knowledge and have time to familiarize yourself with the field, you can just take 2 years to complete another master's degree. The downside here is that it takes time and money, the upside is that you get another degree to your name and time to gain the necessary experience.
Getting a CS undergraduate degree: this is really resetting your academic clock to some degree. It will take you a while (though you may have the option of getting credits for your existing classes, depending on where you take your undergraduate degree). There's nothing wrong with going back to basics, but it is a bit extreme. 


To conclude, what you want to do is not easy, but certainly within the realm of plausibility. I would say that the current hype around AI/ML is not playing in your favor. The competition for these programs can be quite fierce, especially in top schools, so if your life dream is joining them it may require you getting some professional training via a masters at least.