| Moodle APIs 4.3
    Moodle 4.3.6 (Build: 20240812) | 
Python predictions processor. More...
| Public Member Functions | |
| __construct () | |
| The constructor. | |
| classify ($uniqueid, stored_file $dataset, $outputdir) | |
| Classifies the provided dataset samples. | |
| clear_model ($uniqueid, $modelversionoutputdir) | |
| Delete the model version output directory. | |
| delete_output_dir ($modeloutputdir, $uniqueid) | |
| Delete the model output directory. | |
| estimate ($uniqueid, stored_file $dataset, $outputdir) | |
| Estimates linear values for the provided dataset samples. | |
| evaluate_classification ($uniqueid, $maxdeviation, $niterations, stored_file $dataset, $outputdir, $trainedmodeldir) | |
| Evaluates this processor classification model using the provided supervised learning dataset. | |
| evaluate_regression ($uniqueid, $maxdeviation, $niterations, stored_file $dataset, $outputdir, $trainedmodeldir) | |
| Evaluates this processor regression model using the provided supervised learning dataset. | |
| export (string $uniqueid, string $modeldir) | |
| Exports the machine learning model. | |
| import (string $uniqueid, string $modeldir, string $importdir) | |
| Imports the provided machine learning model. | |
| is_ready () | |
| Is the plugin ready to be used?. | |
| train_classification ($uniqueid, stored_file $dataset, $outputdir) | |
| Trains a machine learning algorithm with the provided dataset. | |
| train_regression ($uniqueid, stored_file $dataset, $outputdir) | |
| Train this processor regression model using the provided supervised learning dataset. | |
| Static Public Member Functions | |
| static | check_pip_package_version ($actual, $required=self::REQUIRED_PIP_PACKAGE_VERSION) | 
| Check that the given package version can be used and return the error status. | |
| Public Attributes | |
| const | REQUIRED_PIP_PACKAGE_VERSION = '3.0.5' | 
| The required version of the python package that performs all calculations. | |
| Protected Member Functions | |
| add_extra_result_info (\stdClass $resultobj) | |
| Adds extra information to results info. | |
| exec_command (string $modulename, array $params, string $errorlangstr) | |
| Executes the specified module. | |
| get_file_path (\stored_file $file) | |
| Returns the path to the dataset file. | |
| is_python_server_ready () | |
| Checks if the server can be accessed. | |
| is_webserver_ready () | |
| Checks if the python package is available in the web server executing this script. | |
| server_request ($url, string $method, array $requestparams, ?array $options=null) | |
| Sends a request to the python ML server. | |
Python predictions processor.
| 
 | protected | 
Adds extra information to results info.
| stdClass | $resultobj | 
| stdClass | 
| 
 | static | 
Check that the given package version can be used and return the error status.
When evaluating the version, we assume the sematic versioning scheme as described at https://semver.org/.
| string | $actual | The actual Python package version | 
| string | $required | The required version of the package | 
| int | -1 = actual version is too low, 1 = actual version too high, 0 = actual version is ok | 
| mlbackend_python\processor::classify | ( | $uniqueid, | |
| stored_file | $dataset, | ||
| $outputdir ) | 
Classifies the provided dataset samples.
| string | $uniqueid | |
| stored_file | $dataset | |
| string | $outputdir | 
| stdClass | 
Implements core_analytics\classifier.
| mlbackend_python\processor::clear_model | ( | $uniqueid, | |
| $modelversionoutputdir ) | 
Delete the model version output directory.
| moodle_exception | 
| string | $uniqueid | |
| string | $modelversionoutputdir | 
| null | 
Implements core_analytics\predictor.
| mlbackend_python\processor::delete_output_dir | ( | $modeloutputdir, | |
| $uniqueid ) | 
Delete the model output directory.
| moodle_exception | 
| string | $modeloutputdir | |
| string | $uniqueid | 
| null | 
Implements core_analytics\predictor.
| mlbackend_python\processor::estimate | ( | $uniqueid, | |
| stored_file | $dataset, | ||
| $outputdir ) | 
Estimates linear values for the provided dataset samples.
| new | coding_exception | 
| string | $uniqueid | |
| stored_file | $dataset | |
| mixed | $outputdir | 
| void | 
Implements core_analytics\regressor.
| mlbackend_python\processor::evaluate_classification | ( | $uniqueid, | |
| $maxdeviation, | |||
| $niterations, | |||
| stored_file | $dataset, | ||
| $outputdir, | |||
| $trainedmodeldir ) | 
Evaluates this processor classification model using the provided supervised learning dataset.
| string | $uniqueid | |
| float | $maxdeviation | |
| int | $niterations | |
| stored_file | $dataset | |
| string | $outputdir | |
| string | $trainedmodeldir | 
| stdClass | 
Implements core_analytics\classifier.
| mlbackend_python\processor::evaluate_regression | ( | $uniqueid, | |
| $maxdeviation, | |||
| $niterations, | |||
| stored_file | $dataset, | ||
| $outputdir, | |||
| $trainedmodeldir ) | 
Evaluates this processor regression model using the provided supervised learning dataset.
| new | coding_exception | 
| string | $uniqueid | |
| float | $maxdeviation | |
| int | $niterations | |
| stored_file | $dataset | |
| string | $outputdir | |
| string | $trainedmodeldir | 
| stdClass | 
Implements core_analytics\regressor.
| 
 | protected | 
Executes the specified module.
| string | $modulename | |
| array | $params | |
| string | $errorlangstr | 
| array | [0] is the result body and [1] the exit code. | 
| mlbackend_python\processor::export | ( | string | $uniqueid, | 
| string | $modeldir ) | 
Exports the machine learning model.
| moodle_exception | 
| string | $uniqueid | The model unique id | 
| string | $modeldir | The directory that contains the trained model. | 
| string | The path to the directory that contains the exported model. | 
Implements core_analytics\packable.
| 
 | protected | 
| mlbackend_python\processor::import | ( | string | $uniqueid, | 
| string | $modeldir, | ||
| string | $importdir ) | 
Imports the provided machine learning model.
| string | $uniqueid | The model unique id | 
| string | $modeldir | The directory that will contain the trained model. | 
| string | $importdir | The directory that contains the files to import. | 
| bool | Success | 
Implements core_analytics\packable.
| 
 | protected | 
Checks if the server can be accessed.
| bool|string | True or an error string. | 
| mlbackend_python\processor::is_ready | ( | ) | 
Is the plugin ready to be used?.
| bool|string | Returns true on success, a string detailing the error otherwise | 
Implements core_analytics\predictor.
| 
 | protected | 
Checks if the python package is available in the web server executing this script.
| bool|string | Returns true on success, a string detailing the error otherwise | 
| 
 | protected | 
Sends a request to the python ML server.
| moodle_url | $url | The requested url in the python ML server | 
| string | $method | The curl method to use | 
| array | $requestparams | Curl request params | 
| array | null | $options | Curl request options | 
| array | [0] for the response body and [1] for the http code | 
| mlbackend_python\processor::train_classification | ( | $uniqueid, | |
| stored_file | $dataset, | ||
| $outputdir ) | 
Trains a machine learning algorithm with the provided dataset.
| string | $uniqueid | |
| stored_file | $dataset | |
| string | $outputdir | 
| stdClass | 
Implements core_analytics\classifier.
| mlbackend_python\processor::train_regression | ( | $uniqueid, | |
| stored_file | $dataset, | ||
| $outputdir ) | 
Train this processor regression model using the provided supervised learning dataset.
| new | coding_exception | 
| string | $uniqueid | |
| stored_file | $dataset | |
| string | $outputdir | 
| stdClass | 
Implements core_analytics\regressor.