Get Started With Moodle’s Machine Learning Backends [Updated]

Get Started With Moodle’s Machine Learning Backends (en inglés)

Modified on June 23.

Post Pages - Post Inline - WIRIS

Since Moodle 3.4, a built-in prediction engine gives Moodlers a taste of machine learning functionality. It takes advantage of the Analytics API, the result of the formerly known “Project Inspire” led by Elizabeth Dalton and David Monllaó. Currently, the visual interface offers one prediction, namely the “risk” or likelihood that a given student drops out before the course ends. A more comprehensive visual User Interface was announced earlier this year and the development is still ongoing and focused on back-end issues, among them the improvement of “analytics model display and administration” (Moodle Tracker Issue MDL-62302).

But while the work on the interface moves forward, the Moodle core already offers a robust machine learning engine, known as “Machine learning backends”. The machine learning engine currently offers support for a native PHP engine, and a Python-based engine (that requires extra installation steps). Plans for more compatibility with backends in more languages and services are underway. They provide the standard functions and elements expected in a machine learning library: classifiers, regressors, and evaluation tools, and all can be applied easily to the data and classes the Analytics API makes available. The Moodle Docs recommends the Python engine due to its speed, accuracy, and visual reporting features. The Learning Analytics community page lists some case scenarios for which developers are welcome to use the Machine learning backends: teacher behavior and “course power,” role of parental engagement, optimizing notifications, student deciles and distribution, and the effectiveness of prerequisites.

Responding to a question by self-admitted novice Moodler Cchtou Chtou on the Moodle Forum, Monllaó gave some advice for developers interested in taking advantage of mlbackend for problems involving “supervised” (desired outcome-known) machine learning in the creation of their own models. In short:

  • The mlbackend library, available on GitHub, offers a few examples. (At the time of writing, examples were found for the PHP engine only.)
  • To use the engines in your plugin or for custom development, just extend the mlbackend processor class. In Python, install the moodlemlbackend plugin. (Note: This is not a Moodle plugin.)
  • To create graphics based on results, use the Python engine and a visualization tool. Since the Python engine is based on Tensorflow, the easiest one to integrate with is TensorBoard.
  • The engines are not built to support unsupervised machine learning. If you proceed this route, you are on your own.
  • Developers can access the latest version of Moodle mlbackend for Python at GitHub.

But before heading straight into the programming, some initial requirements are recommended: mainly Python (with NumPy) and TensorFlow. The latter has some previous concepts of its own, from machine learning basics, math (trigonometry, calculus and algebra) and statistics (central tendency measures, histograms, regressions).

Learn more: “Machine learning backends” at

“Analytics API” at■

Modified on June 23. Moodle HQ’s Analytics team leader Elizabeth Dalton offered the following comment:

All currently provided models [PHP and Python] are able to use either backend, because the models currently generate binary predictions, and these can be calculated using logistic regression (in PHP) or feed-forward neural networks (in Python). Our intention is to implement support for more algorithms in both backends, e.g. linear regression, and we also encourage interested developers to implement the API for other backends if they are interested. These extensions will allow the creation of models supporting different types of predictions, such as non-binary classification or probability.

Dalton also emphasized that the backends are planned to offer compatiblity with multiple services other than the built-in PHP and the Python engines.

Moonami LogoThis Moodle Technology related post is made possible by: Moonami a company that provides a full range of Moodle services that combine the flexibility, scalability, and power of Amazon’s world-leading cloud platform (AWS) with fanatical Moodle support. Click here to learn more.