Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions | Protected Attributes | List of all members
core_analytics\dataset_manager Class Reference

Datasets manager. More...

Public Member Functions

 __construct ($modelid, $analysableid, $timesplittingid, $filearea, $evaluation=false)
 Constructor method. More...
 
 store ($data)
 Store the dataset in the internal file system. More...
 

Static Public Member Functions

static clear_model_files ($modelid)
 Delete all files of a model. More...
 
static delete_previous_evaluation_file ($modelid, $timesplittingid)
 Deletes previous evaluation files of this model. More...
 
static export_training_data ($modelid, $timesplittingid)
 Exports the model training data. More...
 
static get_evaluation_analysable_file ($modelid, $analysableid, $timesplittingid)
 Returns this (model + analysable + time splitting) file. More...
 
static get_pending_files ($modelid, $includetarget, $timesplittingids)
 Gets the list of files that couldn't be previously used for training and prediction. More...
 
static get_previous_evaluation_file ($modelid, $timesplittingid)
 Returns the previous evaluation file. More...
 
static get_structured_data (\stored_file $dataset)
 Returns the dataset file data structured by sampleids using the indicators and target column names. More...
 
static merge_datasets (array $files, $modelid, $timesplittingid, $filearea, $evaluation=false)
 Merge multiple files into one. More...
 

Public Attributes

const EVALUATION_FILENAME = 'evaluation.csv'
 Evaluation file file name.
 
const EXPORT_FILEAREA = 'export'
 File area for exported datasets.
 
const LABELLED_FILEAREA = 'labelled'
 File area for labelled datasets.
 
const UNLABELLED_FILEAREA = 'unlabelled'
 File area for unlabelled datasets.
 

Static Protected Member Functions

static get_filename ($evaluation)
 Returns the file name to be used. More...
 

Protected Attributes

int $analysableid
 
bool $evaluation
 Whether this is a dataset for evaluation or not.
 
string $filearea
 The dataset filearea. More...
 
int $modelid
 The model id.
 
string $timesplittingid
 Range processor in use.
 

Detailed Description

Datasets manager.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_analytics\dataset_manager::__construct (   $modelid,
  $analysableid,
  $timesplittingid,
  $filearea,
  $evaluation = false 
)

Constructor method.

Exceptions
coding_exception
Parameters
int$modelid
int$analysableid
string$timesplittingid
string$filearea
bool$evaluation
Return values
void

Member Function Documentation

◆ clear_model_files()

static core_analytics\dataset_manager::clear_model_files (   $modelid)
static

Delete all files of a model.

Parameters
int$modelid
Return values
bool

◆ delete_previous_evaluation_file()

static core_analytics\dataset_manager::delete_previous_evaluation_file (   $modelid,
  $timesplittingid 
)
static

Deletes previous evaluation files of this model.

Parameters
int$modelid
string$timesplittingid
Return values
bool

◆ export_training_data()

static core_analytics\dataset_manager::export_training_data (   $modelid,
  $timesplittingid 
)
static

Exports the model training data.

Parameters
int$modelid
string$timesplittingid
Return values
stored_file|false

◆ get_evaluation_analysable_file()

static core_analytics\dataset_manager::get_evaluation_analysable_file (   $modelid,
  $analysableid,
  $timesplittingid 
)
static

Returns this (model + analysable + time splitting) file.

Parameters
int$modelid
int$analysableid
string$timesplittingid
Return values
stored_file

◆ get_filename()

static core_analytics\dataset_manager::get_filename (   $evaluation)
staticprotected

Returns the file name to be used.

Parameters
strinbool$evaluation
Return values
string

◆ get_pending_files()

static core_analytics\dataset_manager::get_pending_files (   $modelid,
  $includetarget,
  $timesplittingids 
)
static

Gets the list of files that couldn't be previously used for training and prediction.

Parameters
int$modelid
bool$includetarget
string[]$timesplittingids
Return values
null

◆ get_previous_evaluation_file()

static core_analytics\dataset_manager::get_previous_evaluation_file (   $modelid,
  $timesplittingid 
)
static

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

Parameters
int$modelid
string$timesplittingid
Return values
stored_file

◆ get_structured_data()

static core_analytics\dataset_manager::get_structured_data ( \stored_file  $dataset)
static

Returns the dataset file data structured by sampleids using the indicators and target column names.

Parameters
stored_file$dataset
Return values
array

◆ merge_datasets()

static core_analytics\dataset_manager::merge_datasets ( array  $files,
  $modelid,
  $timesplittingid,
  $filearea,
  $evaluation = false 
)
static

Merge multiple files into one.

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

Parameters
array$files
int$modelid
string$timesplittingid
string$filearea
bool$evaluation
Return values
stored_file

◆ store()

core_analytics\dataset_manager::store (   $data)

Store the dataset in the internal file system.

Parameters
array$data
Return values
stored_file

Member Data Documentation

◆ $filearea

string core_analytics\dataset_manager::$filearea
protected

The dataset filearea.

Must be one of the self::*_FILEAREA options.


The documentation for this class was generated from the following file: