Python predictions processor.
More...
|
| __construct () |
| The constructor.
|
|
| classify ($uniqueid, stored_file $dataset, $outputdir) |
| Classifies the provided dataset samples. More...
|
|
| clear_model ($uniqueid, $modelversionoutputdir) |
| Delete the model version output directory. More...
|
|
| delete_output_dir ($modeloutputdir, $uniqueid) |
| Delete the model output directory. More...
|
|
| estimate ($uniqueid, stored_file $dataset, $outputdir) |
| Estimates linear values for the provided dataset samples. More...
|
|
| evaluate_classification ($uniqueid, $maxdeviation, $niterations, stored_file $dataset, $outputdir, $trainedmodeldir) |
| Evaluates this processor classification model using the provided supervised learning dataset. More...
|
|
| evaluate_regression ($uniqueid, $maxdeviation, $niterations, stored_file $dataset, $outputdir, $trainedmodeldir) |
| Evaluates this processor regression model using the provided supervised learning dataset. More...
|
|
| export (string $uniqueid, string $modeldir) |
| Exports the machine learning model. More...
|
|
| import (string $uniqueid, string $modeldir, string $importdir) |
| Imports the provided machine learning model. More...
|
|
| is_ready () |
| Is the plugin ready to be used?. More...
|
|
| train_classification ($uniqueid, stored_file $dataset, $outputdir) |
| Trains a machine learning algorithm with the provided dataset. More...
|
|
| train_regression ($uniqueid, stored_file $dataset, $outputdir) |
| Train this processor regression model using the provided supervised learning dataset. More...
|
|
|
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. More...
|
|
|
const | REQUIRED_PIP_PACKAGE_VERSION = '2.6.4' |
| The required version of the python package that performs all calculations.
|
|
|
string | $host |
| Remote server host.
|
|
string | $password |
| Server password for $this->username.
|
|
string | $pathtopython |
| The path to the Python bin.
|
|
int | $port |
| Remote server port.
|
|
bool | $secure |
| Whether to use http or https.
|
|
string | $username |
| Server username.
|
|
bool | $useserver |
| The python package is installed in a server.
|
|
Python predictions processor.
- Copyright
- 2016 David Monllao
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ add_extra_result_info()
mlbackend_python\processor::add_extra_result_info |
( |
\stdClass |
$resultobj | ) |
|
|
protected |
Adds extra information to results info.
- Parameters
-
- Return values
-
◆ check_pip_package_version()
static mlbackend_python\processor::check_pip_package_version |
( |
|
$actual, |
|
|
|
$required = self::REQUIRED_PIP_PACKAGE_VERSION |
|
) |
| |
|
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/.
- Parameters
-
string | $actual | The actual Python package version |
string | $required | The required version of the package |
- Return values
-
int | -1 = actual version is too low, 1 = actual version too high, 0 = actual version is ok |
◆ classify()
mlbackend_python\processor::classify |
( |
|
$uniqueid, |
|
|
stored_file |
$dataset, |
|
|
|
$outputdir |
|
) |
| |
◆ clear_model()
mlbackend_python\processor::clear_model |
( |
|
$uniqueid, |
|
|
|
$modelversionoutputdir |
|
) |
| |
Delete the model version output directory.
- Exceptions
-
- Parameters
-
string | $uniqueid | |
string | $modelversionoutputdir | |
- Return values
-
Implements core_analytics\predictor.
◆ delete_output_dir()
mlbackend_python\processor::delete_output_dir |
( |
|
$modeloutputdir, |
|
|
|
$uniqueid |
|
) |
| |
Delete the model output directory.
- Exceptions
-
- Parameters
-
string | $modeloutputdir | |
string | $uniqueid | |
- Return values
-
Implements core_analytics\predictor.
◆ estimate()
mlbackend_python\processor::estimate |
( |
|
$uniqueid, |
|
|
stored_file |
$dataset, |
|
|
|
$outputdir |
|
) |
| |
Estimates linear values for the provided dataset samples.
- Exceptions
-
- Parameters
-
- Return values
-
Implements core_analytics\regressor.
◆ evaluate_classification()
mlbackend_python\processor::evaluate_classification |
( |
|
$uniqueid, |
|
|
|
$maxdeviation, |
|
|
|
$niterations, |
|
|
stored_file |
$dataset, |
|
|
|
$outputdir, |
|
|
|
$trainedmodeldir |
|
) |
| |
Evaluates this processor classification model using the provided supervised learning dataset.
- Parameters
-
string | $uniqueid | |
float | $maxdeviation | |
int | $niterations | |
stored_file | $dataset | |
string | $outputdir | |
string | $trainedmodeldir | |
- Return values
-
Implements core_analytics\classifier.
◆ evaluate_regression()
mlbackend_python\processor::evaluate_regression |
( |
|
$uniqueid, |
|
|
|
$maxdeviation, |
|
|
|
$niterations, |
|
|
stored_file |
$dataset, |
|
|
|
$outputdir, |
|
|
|
$trainedmodeldir |
|
) |
| |
Evaluates this processor regression model using the provided supervised learning dataset.
- Exceptions
-
- Parameters
-
string | $uniqueid | |
float | $maxdeviation | |
int | $niterations | |
stored_file | $dataset | |
string | $outputdir | |
string | $trainedmodeldir | |
- Return values
-
Implements core_analytics\regressor.
◆ exec_command()
mlbackend_python\processor::exec_command |
( |
string |
$modulename, |
|
|
array |
$params, |
|
|
string |
$errorlangstr |
|
) |
| |
|
protected |
Executes the specified module.
- Parameters
-
string | $modulename | |
array | $params | |
string | $errorlangstr | |
- Return values
-
array | [0] is the result body and [1] the exit code. |
◆ export()
mlbackend_python\processor::export |
( |
string |
$uniqueid, |
|
|
string |
$modeldir |
|
) |
| |
Exports the machine learning model.
- Exceptions
-
- Parameters
-
string | $uniqueid | The model unique id |
string | $modeldir | The directory that contains the trained model. |
- Return values
-
string | The path to the directory that contains the exported model. |
Implements core_analytics\packable.
◆ get_file_path()
mlbackend_python\processor::get_file_path |
( |
\stored_file |
$file | ) |
|
|
protected |
Returns the path to the dataset file.
- Parameters
-
- Return values
-
◆ import()
mlbackend_python\processor::import |
( |
string |
$uniqueid, |
|
|
string |
$modeldir, |
|
|
string |
$importdir |
|
) |
| |
Imports the provided machine learning model.
- Parameters
-
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. |
- Return values
-
Implements core_analytics\packable.
◆ is_python_server_ready()
mlbackend_python\processor::is_python_server_ready |
( |
| ) |
|
|
protected |
Checks if the server can be accessed.
- Return values
-
bool|string | True or an error string. |
◆ is_ready()
mlbackend_python\processor::is_ready |
( |
| ) |
|
Is the plugin ready to be used?.
- Return values
-
bool|string | Returns true on success, a string detailing the error otherwise |
Implements core_analytics\predictor.
◆ is_webserver_ready()
mlbackend_python\processor::is_webserver_ready |
( |
| ) |
|
|
protected |
Checks if the python package is available in the web server executing this script.
- Return values
-
bool|string | Returns true on success, a string detailing the error otherwise |
◆ server_request()
mlbackend_python\processor::server_request |
( |
|
$url, |
|
|
string |
$method, |
|
|
array |
$requestparams, |
|
|
?array |
$options = null |
|
) |
| |
|
protected |
Sends a request to the python ML server.
- Parameters
-
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 |
- Return values
-
array | [0] for the response body and [1] for the http code |
◆ train_classification()
mlbackend_python\processor::train_classification |
( |
|
$uniqueid, |
|
|
stored_file |
$dataset, |
|
|
|
$outputdir |
|
) |
| |
Trains a machine learning algorithm with the provided dataset.
- Parameters
-
- Return values
-
Implements core_analytics\classifier.
◆ train_regression()
mlbackend_python\processor::train_regression |
( |
|
$uniqueid, |
|
|
stored_file |
$dataset, |
|
|
|
$outputdir |
|
) |
| |
Train this processor regression model using the provided supervised learning dataset.
- Exceptions
-
- Parameters
-
- Return values
-
Implements core_analytics\regressor.
The documentation for this class was generated from the following file: