Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core\analytics\time_splitting\quarters Class Reference

Quarters time splitting method. More...

Inheritance diagram for core\analytics\time_splitting\quarters:
core_analytics\local\time_splitting\equal_parts core_analytics\local\time_splitting\base core_analytics\local\time_splitting\before_now

Public Member Functions

 append_rangeindex ($sampleid, $rangeindex)
 Generates a unique sample id (sample in a range index).
 
 cache_indicator_calculations ()
 Whether to cache or not the indicator calculations.
 
 get_all_ranges ()
 Returns the ranges used by this time splitting method.
 
 get_analysable ()
 get_analysable
 
 get_distinct_ranges ()
 Returns the distinct range indexes in this time splitting method.
 
 get_id ()
 Returns the time splitting method id.
 
 get_most_recent_prediction_range ()
 Returns the most recent range that can be used to predict.
 
 get_range_by_index ($rangeindex)
 Returns range data by its index.
 
 get_training_ranges ()
 By default all ranges are for training.
 
 include_range_info_in_training_data ()
 Whether to include the range index in the training data or not.
 
 infer_sample_info ($uniquesampleid)
 Returns the sample id and the range index from a uniquesampleid.
 
 is_valid_analysable (\core_analytics\analysable $analysable)
 Returns whether the course can be processed by this time splitting method or not.
 
 ready_to_predict ($range)
 Should we predict this time range now?
 
 ready_to_train ($range)
 Should we use this time range for training?
 
 set_analysable (\core_analytics\analysable $analysable)
 Assigns the analysable and updates the time ranges according to the analysable start and end dates.
 
 set_modelid (int $modelid)
 Assigns the model id to this time-splitting method it case it needs it.
 
 valid_for_evaluation ()
 Is this method valid to evaluate prediction models?
 

Static Public Member Functions

static get_name ()
 Returns a lang_string object representing the name for the time spliting method.
 

Protected Member Functions

 define_ranges ()
 Splits the analysable duration in X equal parts from the start to the end.
 
 get_number_parts ()
 4 parts
 
 validate_ranges ()
 Validates the time splitting method ranges.
 

Protected Attributes

core_analytics analysable $analysable
 
string $id
 
int $modelid
 The model id.
 
array $ranges = []
 

Detailed Description

Quarters time splitting method.

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

Member Function Documentation

◆ append_rangeindex()

core_analytics\local\time_splitting\base::append_rangeindex ( $sampleid,
$rangeindex )
finalinherited

Generates a unique sample id (sample in a range index).

Parameters
int$sampleid
int$rangeindex
Return values
string

◆ cache_indicator_calculations()

core_analytics\local\time_splitting\base::cache_indicator_calculations ( )
inherited

Whether to cache or not the indicator calculations.

Indicator calculations are stored to be reused across models. The calculations are indexed by the calculation start and end time, and these times depend on the time-splitting method. You should overwrite this method and return false if the time frames generated by your time-splitting method are unique and / or can hardly be reused by further models.

Return values
bool

Reimplemented in core_analytics\local\time_splitting\after_start, and core_analytics\local\time_splitting\upcoming_periodic.

◆ define_ranges()

core_analytics\local\time_splitting\equal_parts::define_ranges ( )
protectedinherited

Splits the analysable duration in X equal parts from the start to the end.

Return values
array

Reimplemented from core_analytics\local\time_splitting\base.

◆ get_all_ranges()

core_analytics\local\time_splitting\base::get_all_ranges ( )
inherited

Returns the ranges used by this time splitting method.

Return values
array

◆ get_analysable()

core_analytics\local\time_splitting\base::get_analysable ( )
inherited

get_analysable

Return values
core_analytics\analysable

◆ get_distinct_ranges()

core_analytics\local\time_splitting\base::get_distinct_ranges ( )
inherited

Returns the distinct range indexes in this time splitting method.

Return values
int[]

◆ get_id()

core_analytics\local\time_splitting\base::get_id ( )
inherited

Returns the time splitting method id.

Return values
string

◆ get_most_recent_prediction_range()

core_analytics\local\time_splitting\base::get_most_recent_prediction_range ( )
inherited

Returns the most recent range that can be used to predict.

This method is only called when calculating predictions.

Return values
array

◆ get_name()

static core\analytics\time_splitting\quarters::get_name ( )
static

Returns a lang_string object representing the name for the time spliting method.

Used as column identificator.

If there is a corresponding '_help' string this will be shown as well.

Return values
lang_string

Reimplemented from core_analytics\local\time_splitting\base.

◆ get_number_parts()

core\analytics\time_splitting\quarters::get_number_parts ( )
protected

4 parts

Return values
int

Reimplemented from core_analytics\local\time_splitting\equal_parts.

◆ get_range_by_index()

core_analytics\local\time_splitting\base::get_range_by_index ( $rangeindex)
inherited

Returns range data by its index.

Parameters
int$rangeindex
Return values
array|falseRange data or false if the index is not part of the existing ranges.

◆ get_training_ranges()

core_analytics\local\time_splitting\base::get_training_ranges ( )
inherited

By default all ranges are for training.

Return values
array

Reimplemented in core_analytics\local\time_splitting\periodic.

◆ include_range_info_in_training_data()

core_analytics\local\time_splitting\base::include_range_info_in_training_data ( )
inherited

Whether to include the range index in the training data or not.

By default, we consider that the different time ranges included in a time splitting method may not be compatible between them (i.e. the indicators calculated at the end of the course can easily differ from indicators calculated at the beginning of the course). So we include the range index as one of the variables that the machine learning backend uses to generate predictions.

If the indicators calculated using the different time ranges available in this time splitting method are comparable you can overwrite this method to return false.

Note that:

  • This is only relevant for models whose predictions are not based on assumptions (i.e. the ones using a machine learning backend to generate predictions).
  • The ranges can only be included in the training data when we know the final number of ranges the time splitting method will have. E.g. We can not know the final number of ranges of a 'daily' time splitting method as we will have one new range every day.
    Return values
    bool

Reimplemented in core_analytics\local\time_splitting\periodic.

◆ infer_sample_info()

core_analytics\local\time_splitting\base::infer_sample_info ( $uniquesampleid)
finalinherited

Returns the sample id and the range index from a uniquesampleid.

Parameters
string$uniquesampleid
Return values
arrayarray($sampleid, $rangeindex)

◆ is_valid_analysable()

core_analytics\local\time_splitting\base::is_valid_analysable ( \core_analytics\analysable $analysable)
inherited

Returns whether the course can be processed by this time splitting method or not.

Parameters
core_analytics\analysable$analysable
Return values
bool

Reimplemented in core_analytics\local\time_splitting\after_start, and core_analytics\local\time_splitting\periodic.

◆ ready_to_predict()

core_analytics\local\time_splitting\base::ready_to_predict ( $range)
inherited

Should we predict this time range now?

Parameters
array$range
Return values
bool

Reimplemented in core\analytics\time_splitting\no_splitting.

◆ ready_to_train()

core_analytics\local\time_splitting\base::ready_to_train ( $range)
inherited

Should we use this time range for training?

Parameters
array$range
Return values
bool

◆ set_analysable()

core_analytics\local\time_splitting\base::set_analysable ( \core_analytics\analysable $analysable)
inherited

Assigns the analysable and updates the time ranges according to the analysable start and end dates.

Parameters
core_analytics\analysable$analysable
Return values
void

◆ set_modelid()

core_analytics\local\time_splitting\base::set_modelid ( int $modelid)
inherited

Assigns the model id to this time-splitting method it case it needs it.

Parameters
int$modelid

◆ valid_for_evaluation()

core_analytics\local\time_splitting\base::valid_for_evaluation ( )
inherited

Is this method valid to evaluate prediction models?

Return values
bool

Reimplemented in core_analytics\local\time_splitting\upcoming_periodic.

◆ validate_ranges()

core_analytics\local\time_splitting\base::validate_ranges ( )
protectedinherited

Validates the time splitting method ranges.

Exceptions
coding_exception
Return values
void

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