Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Machine learning backends

From MoodleDocs

Introduction

Machine learning backends process the datasets generated from the indicators and targets calculated by the Analytics API. They are used for machine learning training, prediction and models evaluation. May be good that you also read Analytics API to read some concept definitions, how these concepts are implemented in Moodle and how machine learning backend plugins fit into the analytics API.

The communication between machine learning backends and Moodle is through files because the code that will process the dataset can be written in PHP, in Python, in other languages or even use cloud services. This needs to be scalable so they are expected to be able to manage big files and train algorithms reading input files in batches if necessary.

Backends included in Moodle core

The PHP backend is the default predictions processor as it is written in PHP and do not have any external dependencies. It is using logistic regression.

The Python backend requires python binary (either python 2 or python 3) and moodlemlbackend python package which is maintained by Moodle HQ. It is based on Google's tensorflow library and it is using a feed-forward neural network with 1 single hidden layer. moodlemlbackend package does store model performance information that can be visualised using tensorboard. Information generated during models evaluation is available through the models management page, under each model Actions > Log menu. moodlemlbackend source code is available in https://github.com/moodlehq/moodle-mlbackend-python.

Python backend is recommended over the PHP as it is able to predict more accurately than the PHP backend and it is faster.

Interfaces

They have are a new plugin type with a common interface:

  • Evaluate a provided prediction model
  • Train a machine learning algorithm with the existing site data
  • Predict targets based on previously trained algorithms