Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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.

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

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

param: array $data
return: \stored_file

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

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

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

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

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

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

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

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

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.

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

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

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

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

param: \stored_file $dataset
return: array

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

param: int $modelid
return: bool

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

param: strinbool $evaluation
return: string