Get Started With Moodle’s Machine Learning Backends

AI in Education Leaderboard Post Page
Ai In Education Square Post Page

--- Advertisement ---

Updated on February 4, 2020

Among built-in Learning Analytics enginer, Moodle’s offering stands out. 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 originally known “Project Inspire” led by Elizabeth Dalton and David Monllaó. The latest update, in Moodle 3.8, offers the following features:

  • Static, “machine-free” models with simple rules to detect situations of importance for the teacher, using Moodle’s Event functionality for proactive notifications.
  • Dynamic modeling using prediction engines also using Event.
  • Built-in models (including “risk of dropping out”) and tools for custom learning based on a growing set of data fields.
  • Bespoke student engagement indicators.
  • Model benchmarking tools.
  • Suggested actions tied to the kind of prediction made. For example, the predictive dashboard with the “Risk of dropping out” prediction provides a quick notification window where a teacher can send a message to those students more likely to drop out.
  • An API to connect the engine to more sources of data, internal and externally.
  • Complete documentation to modify the engine.

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.

Inside the belly of the beast

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■

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.

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

The Latest

The eLearn Podcast

--- Advertisement ---

Subscribe to our newsletter

Education technology has the power to change lives. 

To get the latest news, information and resources about online learning from around the world by clicking on the button below.