Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core\analytics\time_splitting\one_week_after_start Class Reference

Time splitting method that generates predictions one week after the analysable start. More...

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

Static Public Member Functions

static get_name ()
 The time splitting method name. More...
 

Protected Member Functions

 define_ranges ()
 This time-splitting method returns one single range, the start to two days before the end. More...
 
 get_prediction_interval_start (\core_analytics\analysable $analysable)
 Calculates the interval start time backwards, from now. More...
 
 validate_ranges ()
 Validates the time splitting method ranges. More...
 
 wait_period (\core_analytics\analysable $analysable)
 The period we should wait until we generate predictions for this. More...
 
 wait_period (\core_analytics\analysable $analysable)
 The period we should wait until we generate predictions for this. More...
 

Protected Attributes

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

Detailed Description

Time splitting method that generates predictions one week after the analysable start.

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\after_start::cache_indicator_calculations ( )
inherited

Whether to cache or not the indicator calculations.

Return values
bool

Reimplemented from core_analytics\local\time_splitting\base.

◆ define_ranges()

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

This time-splitting method returns one single range, the start to two days before the end.

Return values
arrayThe list of ranges, each of them including 'start', 'end' and 'time'

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

◆ 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\one_week_after_start::get_name ( )
static

The time splitting method name.

Return values
lang_string

Reimplemented from core_analytics\local\time_splitting\base.

◆ get_prediction_interval_start()

core_analytics\local\time_splitting\after_start::get_prediction_interval_start ( \core_analytics\analysable  $analysable)
protectedinherited

Calculates the interval start time backwards, from now.

Parameters
core_analytics\analysable$analysable
Return values
int

◆ 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\after_start::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 from core_analytics\local\time_splitting\base.

◆ 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

◆ wait_period() [1/2]

core_analytics\local\time_splitting\after_start::wait_period ( \core_analytics\analysable  $analysable)
abstractprotectedinherited

The period we should wait until we generate predictions for this.

Parameters
core_analytics\analysable$analysable
Return values
DateInterval

◆ wait_period() [2/2]

core\analytics\time_splitting\one_week_after_start::wait_period ( \core_analytics\analysable  $analysable)
protected

The period we should wait until we generate predictions for this.

Parameters
core_analytics\analysable$analysableNot used in this implementation.
Return values
DateInterval

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