Hi Cchtou, I've read this post several times, over a number of days, and I am sorry, but I can't get a clear picture of exactly what it is that you want.
You want to develop an algorithm that you want to implement in a Moodle. The algorithm is designed to "learn user profiles". What exactly does that mean? You want to develop an algorithm that allows you to build a model of an average Moodle user? You want to develop an algorithm to use as in a Cambridge-Analytica style? You need to be very clear about what it is you are trying to achieve.
The other thing, "...access to the moodle code and the rights of modifications?" Firstly, it is assumed that you have a Moodle, you may not be an Administrator of that Moodle but you have access to a Moodle. It is assumed that any modification you make, or want to make, is done with the full permission of the Owners of the Moodle. That may be a College, a business, an organization of some sort to support you. If you don't, then you will have to find one. How you do that and how you persuade them to give you access to their Moodle...up to you.
As for modifications, Moodle is Open Source. If you want, download a copy, set it up on your local machine, write your algorithm, then sell it to someone, or rather, the idea of what you want to do. Perhaps though, it might be better for you to look at the development of a report, that is a block of code that can be accessed by an administrator via the Reports sub-menu, that allows you to access the required information. You might want to start with the Development documentation for different ideas on how to approach a problem. I would also suggest here that you post any further questions about development in the General Developer Forum. Good luck.