Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Datasets manager.

Copyright: 2016 David Monllao {@link http://www.davidmonllao.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 457 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: dataset_manager  - X-Ref

Datasets manager.

__construct($modelid, $analysableid, $timesplittingid, $filearea, $evaluation = false)   X-Ref
Constructor method.

return: void
param: int $modelid
param: int $analysableid
param: string $timesplittingid
param: string $filearea
param: bool $evaluation

store($data)   X-Ref
Store the dataset in the internal file system.

return: \stored_file
param: array $data

get_previous_evaluation_file($modelid, $timesplittingid)   X-Ref
Returns the previous evaluation file.

Important to note that this is per modelid + timesplittingid, when dealing with multiple
analysables this is the merged file. Do not confuse with self::get_evaluation_analysable_file

return: \stored_file
param: int $modelid
param: string $timesplittingid

get_pending_files($modelid, $includetarget, $timesplittingids)   X-Ref
Gets the list of files that couldn't be previously used for training and prediction.

return: null
param: int $modelid
param: bool $includetarget
param: string[] $timesplittingids

delete_previous_evaluation_file($modelid, $timesplittingid)   X-Ref
Deletes previous evaluation files of this model.

return: bool
param: int $modelid
param: string $timesplittingid

get_evaluation_analysable_file($modelid, $analysableid, $timesplittingid)   X-Ref
Returns this (model + analysable + time splitting) file.

return: \stored_file
param: int $modelid
param: int $analysableid
param: string $timesplittingid

merge_datasets(array $files, $modelid, $timesplittingid, $filearea, $evaluation = false)   X-Ref
Merge multiple files into one.

Important! It is the caller responsability to ensure that the datasets are compatible.

return: \stored_file
param: array  $files
param: int    $modelid
param: string $timesplittingid
param: string $filearea
param: bool   $evaluation

export_training_data($modelid, $timesplittingid)   X-Ref
Exports the model training data.

return: \stored_file|false
param: int $modelid
param: string $timesplittingid

get_structured_data(\stored_file $dataset)   X-Ref
Returns the dataset file data structured by sampleids using the indicators and target column names.

return: array
param: \stored_file $dataset

clear_model_files($modelid)   X-Ref
Delete all files of a model.

return: bool
param: int $modelid

get_filename($evaluation)   X-Ref
Returns the file name to be used.

return: string
param: strinbool $evaluation